refacto: massive use of getMessageError
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
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 { AppError } from "@/utils/errors";
|
||||
import { getErrorMessage } from "@/utils/errors";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
@@ -20,7 +20,7 @@ export async function GET(
|
||||
{
|
||||
error: {
|
||||
code: error.code,
|
||||
message: ERROR_MESSAGES[error.code],
|
||||
message: getErrorMessage(error.code),
|
||||
},
|
||||
},
|
||||
{ status: 500 }
|
||||
@@ -30,7 +30,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,8 +1,8 @@
|
||||
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 { AppError } from "@/utils/errors";
|
||||
import { getErrorMessage } from "@/utils/errors";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
@@ -18,7 +18,7 @@ export async function GET(
|
||||
{
|
||||
error: {
|
||||
code: ERROR_CODES.BOOK.PAGES_FETCH_ERROR,
|
||||
message: ERROR_MESSAGES[ERROR_CODES.BOOK.PAGES_FETCH_ERROR],
|
||||
message: getErrorMessage(ERROR_CODES.BOOK.PAGES_FETCH_ERROR),
|
||||
},
|
||||
},
|
||||
{ status: 400 }
|
||||
@@ -34,7 +34,7 @@ export async function GET(
|
||||
{
|
||||
error: {
|
||||
code: error.code,
|
||||
message: ERROR_MESSAGES[error.code],
|
||||
message: getErrorMessage(error.code),
|
||||
},
|
||||
},
|
||||
{ status: 500 }
|
||||
@@ -44,7 +44,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,8 +1,8 @@
|
||||
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 { AppError } from "@/utils/errors";
|
||||
import { getErrorMessage } from "@/utils/errors";
|
||||
|
||||
export async function GET(request: NextRequest, { params }: { params: { bookId: string } }) {
|
||||
try {
|
||||
@@ -15,7 +15,7 @@ export async function GET(request: NextRequest, { params }: { params: { bookId:
|
||||
{
|
||||
error: {
|
||||
code: error.code,
|
||||
message: ERROR_MESSAGES[error.code],
|
||||
message: getErrorMessage(error.code),
|
||||
},
|
||||
},
|
||||
{ status: 500 }
|
||||
@@ -25,7 +25,7 @@ export async function GET(request: NextRequest, { params }: { params: { bookId:
|
||||
{
|
||||
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,8 +1,8 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { SeriesService } from "@/lib/services/series.service";
|
||||
import { ERROR_CODES } from "@/constants/errorCodes";
|
||||
import { ERROR_MESSAGES } from "@/constants/errorMessages";
|
||||
import { AppError } from "@/utils/errors";
|
||||
import { getErrorMessage } from "@/utils/errors";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
@@ -17,7 +17,7 @@ export async function GET(request: NextRequest, { params }: { params: { seriesId
|
||||
{
|
||||
error: {
|
||||
code: error.code,
|
||||
message: ERROR_MESSAGES[error.code],
|
||||
message: getErrorMessage(error.code),
|
||||
},
|
||||
},
|
||||
{ status: 500 }
|
||||
@@ -27,7 +27,7 @@ export async function GET(request: NextRequest, { params }: { params: { seriesId
|
||||
{
|
||||
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,8 +1,8 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { SeriesService } from "@/lib/services/series.service";
|
||||
import { ERROR_CODES } from "@/constants/errorCodes";
|
||||
import { ERROR_MESSAGES } from "@/constants/errorMessages";
|
||||
import { AppError } from "@/utils/errors";
|
||||
import { getErrorMessage } from "@/utils/errors";
|
||||
|
||||
export async function GET(request: NextRequest, { params }: { params: { seriesId: string } }) {
|
||||
try {
|
||||
@@ -15,7 +15,7 @@ export async function GET(request: NextRequest, { params }: { params: { seriesId
|
||||
{
|
||||
error: {
|
||||
code: error.code,
|
||||
message: ERROR_MESSAGES[error.code],
|
||||
message: getErrorMessage(error.code),
|
||||
},
|
||||
},
|
||||
{ status: 500 }
|
||||
@@ -25,7 +25,7 @@ export async function GET(request: NextRequest, { params }: { params: { seriesId
|
||||
{
|
||||
error: {
|
||||
code: ERROR_CODES.IMAGE.FETCH_ERROR,
|
||||
message: ERROR_MESSAGES[ERROR_CODES.IMAGE.FETCH_ERROR],
|
||||
message: getErrorMessage(ERROR_CODES.IMAGE.FETCH_ERROR),
|
||||
},
|
||||
},
|
||||
{ status: 500 }
|
||||
|
||||
Reference in New Issue
Block a user