Reference / @getenginex/sdk/testing / fail
fail()
fail(
status,code,message?,details?):Response
Error response in the gateway format ({ success: false, error }), ready for a MockHandler handler. Without message, it uses the code itself.
Parameters
status
number
code
string
message?
string
details?
Record<string, unknown>
Returns
Response
Example
ts
createMockFetch({ routes: { 'POST /api/v1/auth/login': () => fail(401, 'INVALID_CREDENTIALS') } })