@my-swu/simulator-client / EngineHttpErrorOptions
Interface: EngineHttpErrorOptions
Defined in: packages/ts-sdk/src/internal/errors.ts:23
Context captured for one non-2xx HTTP response.
These fields make HTTP failures safe to render or log without parsing the original Response object again.
Example:
import type { EngineHttpErrorOptions } from '@my-swu/simulator-client'
const engineHttpErrorOptions: EngineHttpErrorOptions = {
status: 404,
code: 'match_not_found',
method: 'GET',
url: 'http://127.0.0.1:4000/api/matches/missing',
}
console.log(engineHttpErrorOptions)Example
import type { EngineHttpErrorOptions } from '@my-swu/simulator-client'
const notFoundOptions: EngineHttpErrorOptions = {
status: 404,
code: 'match_not_found',
method: 'GET',
url: 'http://127.0.0.1:4000/api/matches/missing',
}
console.log(notFoundOptions.status)See
https://simulator-sdk.my-swu.com/guide/errors
Properties
code?
Example:
import type { EngineHttpErrorOptions } from '@my-swu/simulator-client'
const engineHttpErrorOptions: EngineHttpErrorOptions = {
status: 404,
code: 'match_not_found',
method: 'GET',
url: 'http://127.0.0.1:4000/api/matches/missing',
}
const { code: errorCode } = engineHttpErrorOptions
console.log(errorCode)
optionalcode?:string
Defined in: packages/ts-sdk/src/internal/errors.ts:27
Engine error code when the response body matched api-error-response.
method?
Example:
import type { EngineHttpErrorOptions } from '@my-swu/simulator-client'
const engineHttpErrorOptions: EngineHttpErrorOptions = {
status: 404,
code: 'match_not_found',
method: 'GET',
url: 'http://127.0.0.1:4000/api/matches/missing',
}
const { method: httpMethod } = engineHttpErrorOptions
console.log(httpMethod)
optionalmethod?:string
Defined in: packages/ts-sdk/src/internal/errors.ts:31
HTTP method used for the failed request.
payload?
Example:
import type { EngineHttpErrorOptions } from '@my-swu/simulator-client'
const engineHttpErrorOptions: EngineHttpErrorOptions = {
status: 404,
code: 'match_not_found',
method: 'GET',
url: 'http://127.0.0.1:4000/api/matches/missing',
}
const { payload } = engineHttpErrorOptions
console.log(payload)
optionalpayload?:unknown
Defined in: packages/ts-sdk/src/internal/errors.ts:35
Parsed JSON payload when an error body was JSON but not a valid engine error.
responseText?
Example:
import type { EngineHttpErrorOptions } from '@my-swu/simulator-client'
const engineHttpErrorOptions: EngineHttpErrorOptions = {
status: 404,
code: 'match_not_found',
method: 'GET',
url: 'http://127.0.0.1:4000/api/matches/missing',
}
const { responseText } = engineHttpErrorOptions
console.log(responseText)
optionalresponseText?:string
Defined in: packages/ts-sdk/src/internal/errors.ts:39
Raw response text when the server returned an error body.
status
Example:
import type { EngineHttpErrorOptions } from '@my-swu/simulator-client'
const engineHttpErrorOptions: EngineHttpErrorOptions = {
status: 404,
code: 'match_not_found',
method: 'GET',
url: 'http://127.0.0.1:4000/api/matches/missing',
}
const { status: healthStatus } = engineHttpErrorOptions
console.log(healthStatus)status:
number
Defined in: packages/ts-sdk/src/internal/errors.ts:43
HTTP response status.
url?
Example:
import type { EngineHttpErrorOptions } from '@my-swu/simulator-client'
const engineHttpErrorOptions: EngineHttpErrorOptions = {
status: 404,
code: 'match_not_found',
method: 'GET',
url: 'http://127.0.0.1:4000/api/matches/missing',
}
const { url: requestUrl } = engineHttpErrorOptions
console.log(requestUrl)
optionalurl?:string
Defined in: packages/ts-sdk/src/internal/errors.ts:47
Fully resolved request URL.
