diff --git a/src/modules/auth/services/http/githubCallback.service.ts b/src/modules/auth/services/http/githubCallback.service.ts index cb17987..fae469e 100644 --- a/src/modules/auth/services/http/githubCallback.service.ts +++ b/src/modules/auth/services/http/githubCallback.service.ts @@ -1,4 +1,4 @@ -import { AppError } from "../../../../helpers/error/instances/app"; +import { ErrorForwarder } from "../../../../helpers/error/instances/forwarder"; import { UserHeaderInformation } from "../../../../helpers/http/userHeader/getUserHeaderInformation/types"; import { GithubCallbackUserData } from "../../auth.types"; import { githubProvider } from "../../providers/github.provider"; @@ -54,6 +54,6 @@ export const githubCallbackService = async ( userHeaderInfo ); } catch (error) { - return new AppError(500, "Authentication service error", error); + ErrorForwarder(error, 500, "Authentication service error"); } }; diff --git a/src/modules/user/repositories/create/createUserViaRegister.repository.ts b/src/modules/user/repositories/create/createUserViaRegister.repository.ts index 4578aa2..159eab7 100644 --- a/src/modules/user/repositories/create/createUserViaRegister.repository.ts +++ b/src/modules/user/repositories/create/createUserViaRegister.repository.ts @@ -1,10 +1,15 @@ +import { ErrorForwarder } from "../../../../helpers/error/instances/forwarder"; import { userModel } from "../../user.model"; import { createUserViaRegisterInput } from "../../user.types"; export const createUserViaRegisterRepository = async ( payload: createUserViaRegisterInput ) => { - return await userModel.create({ - data: payload, - }); + try { + return await userModel.create({ + data: payload, + }); + } catch (error) { + ErrorForwarder(error); + } };