Skip to content

Commit

Permalink
error.unauthorized
Browse files Browse the repository at this point in the history
  • Loading branch information
zobkazi committed May 9, 2024
1 parent 28d417c commit 42fa3b8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/services/auth/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ app.use("/auth", router);
// handler
app.use(error.notFound);
app.use(error.serverError);
app.use(error.invalidInput);
app.use(error.unauthorized);

const port = process.env.PORT || 4001;
const serviceName = process.env.SERVICE_NAME || "Auth-Service";
Expand Down
8 changes: 8 additions & 0 deletions packages/services/auth/src/utils/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,11 @@ export const authenticationError = (msg = "Authentication Failed") => {
export const authorizationError = (msg = "Permission Denied") => {
return new HTTPError(msg, 403);
};

export function invalidInput(invalidInput: any) {
throw new Error("Function not implemented.");
}
export function unauthorized(unauthorized: any) {
throw new Error("Function not implemented.");
}

0 comments on commit 42fa3b8

Please sign in to comment.