diff options
Diffstat (limited to 'ext/http/00_serve.ts')
-rw-r--r-- | ext/http/00_serve.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/http/00_serve.ts b/ext/http/00_serve.ts index 02910d580..c8f4e0604 100644 --- a/ext/http/00_serve.ts +++ b/ext/http/00_serve.ts @@ -457,7 +457,7 @@ function fastSyncResponseOrStream( // At this point in the response it needs to be a stream if (!ObjectPrototypeIsPrototypeOf(ReadableStreamPrototype, stream)) { innerRequest?.close(); - throw TypeError("invalid response"); + throw new TypeError("invalid response"); } const resourceBacking = getReadableStreamResourceBacking(stream); let rid, autoClose; @@ -506,13 +506,13 @@ function mapToCallback(context, callback, onError) { // Throwing Error if the handler return value is not a Response class if (!ObjectPrototypeIsPrototypeOf(ResponsePrototype, response)) { - throw TypeError( + throw new TypeError( "Return value from serve handler must be a response or a promise resolving to a response", ); } if (response.bodyUsed) { - throw TypeError( + throw new TypeError( "The body of the Response returned from the serve handler has already been consumed.", ); } @@ -520,7 +520,7 @@ function mapToCallback(context, callback, onError) { try { response = await onError(error); if (!ObjectPrototypeIsPrototypeOf(ResponsePrototype, response)) { - throw TypeError( + throw new TypeError( "Return value from onError handler must be a response or a promise resolving to a response", ); } |