@@ -20,7 +20,7 @@ class ParameterValidationError extends RouteMatchingError {
20
20
}
21
21
}
22
22
23
- abstract class ServiceError extends Error {
23
+ abstract class HttpError extends Error {
24
24
abstract readonly statusCode : HttpStatusCode ;
25
25
abstract readonly errorType : string ;
26
26
public readonly details ?: Record < string , unknown > ;
@@ -31,7 +31,7 @@ abstract class ServiceError extends Error {
31
31
details ?: Record < string , unknown >
32
32
) {
33
33
super ( message , options ) ;
34
- this . name = 'ServiceError ' ;
34
+ this . name = 'HttpError ' ;
35
35
this . details = details ;
36
36
}
37
37
@@ -47,7 +47,7 @@ abstract class ServiceError extends Error {
47
47
}
48
48
}
49
49
50
- class BadRequestError extends ServiceError {
50
+ class BadRequestError extends HttpError {
51
51
readonly statusCode = HttpStatusCodes . BAD_REQUEST ;
52
52
readonly errorType = 'BadRequestError' ;
53
53
@@ -61,7 +61,7 @@ class BadRequestError extends ServiceError {
61
61
}
62
62
}
63
63
64
- class UnauthorizedError extends ServiceError {
64
+ class UnauthorizedError extends HttpError {
65
65
readonly statusCode = HttpStatusCodes . UNAUTHORIZED ;
66
66
readonly errorType = 'UnauthorizedError' ;
67
67
@@ -75,7 +75,7 @@ class UnauthorizedError extends ServiceError {
75
75
}
76
76
}
77
77
78
- class ForbiddenError extends ServiceError {
78
+ class ForbiddenError extends HttpError {
79
79
readonly statusCode = HttpStatusCodes . FORBIDDEN ;
80
80
readonly errorType = 'ForbiddenError' ;
81
81
@@ -89,7 +89,7 @@ class ForbiddenError extends ServiceError {
89
89
}
90
90
}
91
91
92
- class NotFoundError extends ServiceError {
92
+ class NotFoundError extends HttpError {
93
93
readonly statusCode = HttpStatusCodes . NOT_FOUND ;
94
94
readonly errorType = 'NotFoundError' ;
95
95
@@ -103,7 +103,7 @@ class NotFoundError extends ServiceError {
103
103
}
104
104
}
105
105
106
- class MethodNotAllowedError extends ServiceError {
106
+ class MethodNotAllowedError extends HttpError {
107
107
readonly statusCode = HttpStatusCodes . METHOD_NOT_ALLOWED ;
108
108
readonly errorType = 'MethodNotAllowedError' ;
109
109
@@ -117,7 +117,7 @@ class MethodNotAllowedError extends ServiceError {
117
117
}
118
118
}
119
119
120
- class RequestTimeoutError extends ServiceError {
120
+ class RequestTimeoutError extends HttpError {
121
121
readonly statusCode = HttpStatusCodes . REQUEST_TIMEOUT ;
122
122
readonly errorType = 'RequestTimeoutError' ;
123
123
@@ -131,7 +131,7 @@ class RequestTimeoutError extends ServiceError {
131
131
}
132
132
}
133
133
134
- class RequestEntityTooLargeError extends ServiceError {
134
+ class RequestEntityTooLargeError extends HttpError {
135
135
readonly statusCode = HttpStatusCodes . REQUEST_ENTITY_TOO_LARGE ;
136
136
readonly errorType = 'RequestEntityTooLargeError' ;
137
137
@@ -145,7 +145,7 @@ class RequestEntityTooLargeError extends ServiceError {
145
145
}
146
146
}
147
147
148
- class InternalServerError extends ServiceError {
148
+ class InternalServerError extends HttpError {
149
149
readonly statusCode = HttpStatusCodes . INTERNAL_SERVER_ERROR ;
150
150
readonly errorType = 'InternalServerError' ;
151
151
@@ -159,7 +159,7 @@ class InternalServerError extends ServiceError {
159
159
}
160
160
}
161
161
162
- class ServiceUnavailableError extends ServiceError {
162
+ class ServiceUnavailableError extends HttpError {
163
163
readonly statusCode = HttpStatusCodes . SERVICE_UNAVAILABLE ;
164
164
readonly errorType = 'ServiceUnavailableError' ;
165
165
@@ -183,7 +183,7 @@ export {
183
183
RequestEntityTooLargeError ,
184
184
RequestTimeoutError ,
185
185
RouteMatchingError ,
186
- ServiceError ,
186
+ HttpError ,
187
187
ServiceUnavailableError ,
188
188
UnauthorizedError ,
189
189
} ;
0 commit comments