Skip to content

Commit 8bf6316

Browse files
committed
1 parent eebc811 commit 8bf6316

File tree

6 files changed

+18
-2
lines changed

6 files changed

+18
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "strontium",
3-
"version": "2.2.0",
3+
"version": "2.2.2",
44
"description": "Strontium is a TypeScript toolkit for High Performance API servers built for Production not Projects.",
55
"main": "lib/src/index.js",
66
"types": "lib/src/index.d.ts",

src/errors/TransientError.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
import { StrontiumError } from "./StrontiumError"
22

3-
export class TransientError extends StrontiumError {}
3+
export class TransientError extends StrontiumError {
4+
constructor(message?: string) {
5+
super(message)
6+
7+
Object.setPrototypeOf(this, TransientError.prototype)
8+
}
9+
}

src/errors/http/HTTPError.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ export abstract class HTTPError extends StrontiumError {
77
public internalMessage?: string
88
) {
99
super(internalMessage)
10+
11+
Object.setPrototypeOf(this, HTTPError.prototype)
1012
}
1113

1214
toResponseBody(): { statusCode: number; errorMessage: string } {

src/errors/http/InternalServerError.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@ export class InternalServerError extends HTTPError {
77
"An internal error occurred. The system administrator has been notified.",
88
"Internal Error occurred."
99
)
10+
11+
Object.setPrototypeOf(this, InternalServerError.prototype)
1012
}
1113
}

src/errors/http/ValidationError.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ export class ValidationError extends HTTPError {
88
public fieldPath?: string
99
) {
1010
super(400, externalMessage, internalMessage)
11+
12+
Object.setPrototypeOf(this, ValidationError.prototype)
1113
}
1214

1315
public toResponseBody(): {

src/validation/abstract/ValidatorFunction.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ export type ValidatorOutput<
44
I,
55
P extends ValidatorFunction<I, any>
66
> = P extends ValidatorFunction<I, infer O> ? O : ReturnType<P>
7+
8+
export type ValidatorInput<
9+
P extends ValidatorFunction<any, any>
10+
> = P extends ValidatorFunction<infer I, any> ? I : ReturnType<P>

0 commit comments

Comments
 (0)