refacto: massive use of getMessageError
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { BookService } from "@/lib/services/book.service";
|
||||
import { ERROR_CODES } from "@/constants/errorCodes";
|
||||
import { ERROR_MESSAGES } from "@/constants/errorMessages";
|
||||
import { getErrorMessage } from "@/utils/errors";
|
||||
import { AppError } from "@/utils/errors";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
@@ -17,7 +17,7 @@ export async function GET(
|
||||
{
|
||||
error: {
|
||||
code: ERROR_CODES.IMAGE.FETCH_ERROR,
|
||||
message: ERROR_MESSAGES[ERROR_CODES.IMAGE.FETCH_ERROR],
|
||||
message: getErrorMessage(ERROR_CODES.IMAGE.FETCH_ERROR),
|
||||
},
|
||||
},
|
||||
{ status: 400 }
|
||||
@@ -41,7 +41,7 @@ export async function GET(
|
||||
{
|
||||
error: {
|
||||
code: error.code,
|
||||
message: ERROR_MESSAGES[error.code],
|
||||
message: getErrorMessage(error.code),
|
||||
},
|
||||
},
|
||||
{ status: 500 }
|
||||
@@ -51,7 +51,7 @@ export async function GET(
|
||||
{
|
||||
error: {
|
||||
code: ERROR_CODES.IMAGE.FETCH_ERROR,
|
||||
message: ERROR_MESSAGES[ERROR_CODES.IMAGE.FETCH_ERROR],
|
||||
message: getErrorMessage(ERROR_CODES.IMAGE.FETCH_ERROR),
|
||||
},
|
||||
},
|
||||
{ status: 500 }
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { BookService } from "@/lib/services/book.service";
|
||||
import { ERROR_CODES } from "@/constants/errorCodes";
|
||||
import { ERROR_MESSAGES } from "@/constants/errorMessages";
|
||||
import { getErrorMessage } from "@/utils/errors";
|
||||
import { AppError } from "@/utils/errors";
|
||||
|
||||
export async function PATCH(request: NextRequest, { params }: { params: { bookId: string } }) {
|
||||
@@ -13,7 +13,7 @@ export async function PATCH(request: NextRequest, { params }: { params: { bookId
|
||||
{
|
||||
error: {
|
||||
code: ERROR_CODES.BOOK.PROGRESS_UPDATE_ERROR,
|
||||
message: ERROR_MESSAGES[ERROR_CODES.BOOK.PROGRESS_UPDATE_ERROR],
|
||||
message: getErrorMessage(ERROR_CODES.BOOK.PROGRESS_UPDATE_ERROR),
|
||||
},
|
||||
},
|
||||
{ status: 400 }
|
||||
@@ -29,7 +29,7 @@ export async function PATCH(request: NextRequest, { params }: { params: { bookId
|
||||
{
|
||||
error: {
|
||||
code: error.code,
|
||||
message: ERROR_MESSAGES[error.code],
|
||||
message: getErrorMessage(error.code),
|
||||
},
|
||||
},
|
||||
{ status: 500 }
|
||||
@@ -39,7 +39,7 @@ export async function PATCH(request: NextRequest, { params }: { params: { bookId
|
||||
{
|
||||
error: {
|
||||
code: ERROR_CODES.BOOK.PROGRESS_UPDATE_ERROR,
|
||||
message: ERROR_MESSAGES[ERROR_CODES.BOOK.PROGRESS_UPDATE_ERROR],
|
||||
message: getErrorMessage(ERROR_CODES.BOOK.PROGRESS_UPDATE_ERROR),
|
||||
},
|
||||
},
|
||||
{ status: 500 }
|
||||
@@ -58,7 +58,7 @@ export async function DELETE(request: NextRequest, { params }: { params: { bookI
|
||||
{
|
||||
error: {
|
||||
code: error.code,
|
||||
message: ERROR_MESSAGES[error.code],
|
||||
message: getErrorMessage(error.code),
|
||||
},
|
||||
},
|
||||
{ status: 500 }
|
||||
@@ -68,7 +68,7 @@ export async function DELETE(request: NextRequest, { params }: { params: { bookI
|
||||
{
|
||||
error: {
|
||||
code: ERROR_CODES.BOOK.PROGRESS_DELETE_ERROR,
|
||||
message: ERROR_MESSAGES[ERROR_CODES.BOOK.PROGRESS_DELETE_ERROR],
|
||||
message: getErrorMessage(ERROR_CODES.BOOK.PROGRESS_DELETE_ERROR),
|
||||
},
|
||||
},
|
||||
{ status: 500 }
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { BookService } from "@/lib/services/book.service";
|
||||
import { ERROR_CODES } from "@/constants/errorCodes";
|
||||
import { ERROR_MESSAGES } from "@/constants/errorMessages";
|
||||
import { getErrorMessage } from "@/utils/errors";
|
||||
import { AppError } from "@/utils/errors";
|
||||
import { KomgaBookWithPages } from "@/types/komga";
|
||||
export async function GET(request: Request, { params }: { params: { bookId: string } }) {
|
||||
@@ -15,7 +15,7 @@ export async function GET(request: Request, { params }: { params: { bookId: stri
|
||||
{
|
||||
error: {
|
||||
code: error.code,
|
||||
message: ERROR_MESSAGES[error.code],
|
||||
message: getErrorMessage(error.code),
|
||||
},
|
||||
},
|
||||
{ status: 500 }
|
||||
@@ -25,7 +25,7 @@ export async function GET(request: Request, { params }: { params: { bookId: stri
|
||||
{
|
||||
error: {
|
||||
code: ERROR_CODES.BOOK.NOT_FOUND,
|
||||
message: ERROR_MESSAGES[ERROR_CODES.BOOK.NOT_FOUND],
|
||||
message: getErrorMessage(ERROR_CODES.BOOK.NOT_FOUND),
|
||||
},
|
||||
},
|
||||
{ status: 500 }
|
||||
|
||||
Reference in New Issue
Block a user