🧑💻 (dev) improve error handler
This commit is contained in:
@ -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 { UserHeaderInformation } from "../../../../helpers/http/userHeader/getUserHeaderInformation/types";
|
||||||
import { GithubCallbackUserData } from "../../auth.types";
|
import { GithubCallbackUserData } from "../../auth.types";
|
||||||
import { githubProvider } from "../../providers/github.provider";
|
import { githubProvider } from "../../providers/github.provider";
|
||||||
@ -54,6 +54,6 @@ export const githubCallbackService = async (
|
|||||||
userHeaderInfo
|
userHeaderInfo
|
||||||
);
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return new AppError(500, "Authentication service error", error);
|
ErrorForwarder(error, 500, "Authentication service error");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,10 +1,15 @@
|
|||||||
|
import { ErrorForwarder } from "../../../../helpers/error/instances/forwarder";
|
||||||
import { userModel } from "../../user.model";
|
import { userModel } from "../../user.model";
|
||||||
import { createUserViaRegisterInput } from "../../user.types";
|
import { createUserViaRegisterInput } from "../../user.types";
|
||||||
|
|
||||||
export const createUserViaRegisterRepository = async (
|
export const createUserViaRegisterRepository = async (
|
||||||
payload: createUserViaRegisterInput
|
payload: createUserViaRegisterInput
|
||||||
) => {
|
) => {
|
||||||
|
try {
|
||||||
return await userModel.create({
|
return await userModel.create({
|
||||||
data: payload,
|
data: payload,
|
||||||
});
|
});
|
||||||
|
} catch (error) {
|
||||||
|
ErrorForwarder(error);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user