File tree Expand file tree Collapse file tree 4 files changed +26
-2
lines changed Expand file tree Collapse file tree 4 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import axios from "axios";
22import env from "@config" ;
33import userModel from "@apis/user/model" ;
44import * as jwt from "@utils/jwt" ;
5- import AuthorizationError from "@exceptions /authorization-error" ;
5+ import AuthorizationError from "@errors /authorization-error" ;
66
77interface TokenResponse {
88 access_token : string ;
Original file line number Diff line number Diff line change 1+ import CustomError from "." ;
2+ import { UNAUTHORIZED } from "@constants/http-status" ;
3+
4+ export default class AuthorizationError extends CustomError {
5+ constructor ( message : string = "Unauthorized" ) {
6+ super ( message , UNAUTHORIZED ) ;
7+ }
8+ }
Original file line number Diff line number Diff line change 1+ import { INTERNAL_SERVER_ERROR } from "@constants/http-status" ;
2+
3+ export default class CustomError extends Error {
4+ message ! : string ;
5+ status ! : number ;
6+
7+ constructor (
8+ message : string = "Internal Server Error" ,
9+ status : number = INTERNAL_SERVER_ERROR
10+ ) {
11+ super ( ) ;
12+
13+ this . message = message ;
14+ this . status = status ;
15+ }
16+ }
Original file line number Diff line number Diff line change 55 "@apis/*" : [" apis/*" ],
66 "@config" : [" config" ],
77 "@constants/*" : [" constants/*" ],
8- "@exceptions /*" : [" exceptions /*" ],
8+ "@errors /*" : [" errors /*" ],
99 "@db" : [" db" ],
1010 "@middlewares/*" : [" middlewares/*" ],
1111 "@utils/*" : [" utils/*" ]
You can’t perform that action at this time.
0 commit comments