Describe the bug
If a stored procedure calls an async function, and that function throws an error, the client response will still have status code 200, and the error will not be present anywhere in the response body (the resource of the response will be set to an empty string). This is the case even if catch() is called on the promise.
Execute the stored procedure through your API of choice.
Appending an error handler that places the error in the response body works as expected, but this is a lousy workaround as the HTTP status code of the response will still be OK.
Note that this does not occur if an error is thrown directly from an ordinary function; it only occurs if an error is thrown from an async function (even if, as above, the function never suspends execution).
Expected behavior
The error should be correctly propagated to the response body and the corresponding HTTP status code should indicate an error state. This could either be built in to the runtime, or else exposed as a handler that can be passed to a promise's catch block.
Describe the bug If a stored procedure calls an async function, and that function throws an error, the client response will still have status code 200, and the error will not be present anywhere in the response body (the
resource
of the response will be set to an empty string). This is the case even ifcatch()
is called on the promise.To Reproduce Steps to reproduce the behavior:
Appending an error handler that places the error in the response body works as expected, but this is a lousy workaround as the HTTP status code of the response will still be
OK
.Note that this does not occur if an error is thrown directly from an ordinary function; it only occurs if an error is thrown from an async function (even if, as above, the function never suspends execution).
Expected behavior The error should be correctly propagated to the response body and the corresponding HTTP status code should indicate an error state. This could either be built in to the runtime, or else exposed as a handler that can be passed to a promise's
catch
block.