@my-swu/simulator-client / EngineRequestAbortedError
Class: EngineRequestAbortedError
Defined in: packages/ts-sdk/src/internal/abort-error.ts:74
Error thrown when a simulator HTTP request is cancelled before it answers.
This is the fourth SDK failure channel next to EngineHttpError (the server answered with a non-2xx status), SdkValidationError (a payload did not match the schema), and SimulatorSocketError (a socket failed). Read kind to tell a caller-initiated abort from a timeout.
Example:
import { EngineRequestAbortedError } from '@my-swu/simulator-client'
// Construct directly when testing cancellation handling.
const abortedError = new EngineRequestAbortedError('timeout', {
method: 'GET',
timeoutMs: 5_000,
url: 'http://127.0.0.1:4000/api/matches/match_123',
})
console.log(abortedError)Example
import { EngineRequestAbortedError, createSimulatorClient } from '@my-swu/simulator-client'
const simulatorClient = createSimulatorClient({ baseUrl: 'http://127.0.0.1:4000' })
try {
await simulatorClient.system.health({ timeoutMs: 2_000 })
}
catch (error) {
if (error instanceof EngineRequestAbortedError && error.kind === 'timeout') {
console.warn('health check timed out after', error.timeoutMs)
}
}See
https://simulator-sdk.my-swu.com/guide/errors
Extends
Error
Constructors
Constructor
Example:
import { EngineRequestAbortedError } from '@my-swu/simulator-client'
// Construct directly when testing cancellation handling.
const abortedError = new EngineRequestAbortedError('timeout', {
method: 'GET',
timeoutMs: 5_000,
url: 'http://127.0.0.1:4000/api/matches/match_123',
})
console.log(abortedError)new EngineRequestAbortedError(
kind,options?):EngineRequestAbortedError
Defined in: packages/ts-sdk/src/internal/abort-error.ts:93
Creates one classified cancellation error with its request context.
Parameters
kind
options?
EngineRequestAbortedErrorOptions = {}
Returns
EngineRequestAbortedError
Overrides
Error.constructor
Properties
cause?
Example:
import { EngineRequestAbortedError } from '@my-swu/simulator-client'
// Construct directly when testing cancellation handling.
const abortedError = new EngineRequestAbortedError('timeout', {
method: 'GET',
timeoutMs: 5_000,
url: 'http://127.0.0.1:4000/api/matches/match_123',
})
const { cause } = abortedError
console.log(cause)
optionalcause?:unknown
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts:26
Inherited from
Error.cause
kind
Example:
import { EngineRequestAbortedError } from '@my-swu/simulator-client'
// Construct directly when testing cancellation handling.
const abortedError = new EngineRequestAbortedError('timeout', {
method: 'GET',
timeoutMs: 5_000,
url: 'http://127.0.0.1:4000/api/matches/match_123',
})
const { kind } = abortedError
console.log(kind)
readonlykind:EngineRequestAbortKind
Defined in: packages/ts-sdk/src/internal/abort-error.ts:78
Stable classification of the cancellation.
message
Example:
import { EngineRequestAbortedError } from '@my-swu/simulator-client'
// Construct directly when testing cancellation handling.
const abortedError = new EngineRequestAbortedError('timeout', {
method: 'GET',
timeoutMs: 5_000,
url: 'http://127.0.0.1:4000/api/matches/match_123',
})
const { message } = abortedError
console.log(message)message:
string
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1077
Inherited from
Error.message
method
Example:
import { EngineRequestAbortedError } from '@my-swu/simulator-client'
// Construct directly when testing cancellation handling.
const abortedError = new EngineRequestAbortedError('timeout', {
method: 'GET',
timeoutMs: 5_000,
url: 'http://127.0.0.1:4000/api/matches/match_123',
})
const { method: httpMethod } = abortedError
console.log(httpMethod)
readonlymethod:string|undefined
Defined in: packages/ts-sdk/src/internal/abort-error.ts:82
HTTP method used for the cancelled request.
name
Example:
import { EngineRequestAbortedError } from '@my-swu/simulator-client'
// Construct directly when testing cancellation handling.
const abortedError = new EngineRequestAbortedError('timeout', {
method: 'GET',
timeoutMs: 5_000,
url: 'http://127.0.0.1:4000/api/matches/match_123',
})
const { name } = abortedError
console.log(name)name:
string
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1076
Inherited from
Error.name
stack?
Example:
import { EngineRequestAbortedError } from '@my-swu/simulator-client'
// Construct directly when testing cancellation handling.
const abortedError = new EngineRequestAbortedError('timeout', {
method: 'GET',
timeoutMs: 5_000,
url: 'http://127.0.0.1:4000/api/matches/match_123',
})
const { stack } = abortedError
console.log(stack)
optionalstack?:string
Defined in: node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts:1078
Inherited from
Error.stack
timeoutMs
Example:
import { EngineRequestAbortedError } from '@my-swu/simulator-client'
// Construct directly when testing cancellation handling.
const abortedError = new EngineRequestAbortedError('timeout', {
method: 'GET',
timeoutMs: 5_000,
url: 'http://127.0.0.1:4000/api/matches/match_123',
})
const { timeoutMs } = abortedError
console.log(timeoutMs)
readonlytimeoutMs:number|undefined
Defined in: packages/ts-sdk/src/internal/abort-error.ts:86
Timeout that applied to the request, when one did.
url
Example:
import { EngineRequestAbortedError } from '@my-swu/simulator-client'
// Construct directly when testing cancellation handling.
const abortedError = new EngineRequestAbortedError('timeout', {
method: 'GET',
timeoutMs: 5_000,
url: 'http://127.0.0.1:4000/api/matches/match_123',
})
const { url: requestUrl } = abortedError
console.log(requestUrl)
readonlyurl:string|undefined
Defined in: packages/ts-sdk/src/internal/abort-error.ts:90
Fully resolved request URL.
stackTraceLimit
Example:
Error.stackTraceLimit = 20
staticstackTraceLimit:number
Defined in: node_modules/.pnpm/@types+node@24.12.2/node_modules/@types/node/globals.d.ts:68
The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).
The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.
If set to a non-number value, or set to a negative number, stack traces will not capture any frames.
Inherited from
Error.stackTraceLimit
Methods
captureStackTrace()
Example:
import { EngineRequestAbortedError } from '@my-swu/simulator-client'
// Construct directly when testing cancellation handling.
const abortedError = new EngineRequestAbortedError('timeout', {
method: 'GET',
timeoutMs: 5_000,
url: 'http://127.0.0.1:4000/api/matches/match_123',
})
Error.captureStackTrace(abortedError, EngineRequestAbortedError)
staticcaptureStackTrace(targetObject,constructorOpt?):void
Defined in: node_modules/.pnpm/@types+node@24.12.2/node_modules/@types/node/globals.d.ts:52
Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack; // Similar to `new Error().stack`The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.
The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.
The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:
function a() {
b();
}
function b() {
c();
}
function c() {
// Create an error without stack trace to avoid calculating the stack trace twice.
const { stackTraceLimit } = Error;
Error.stackTraceLimit = 0;
const error = new Error();
Error.stackTraceLimit = stackTraceLimit;
// Capture the stack trace above function b
Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
throw error;
}
a();Parameters
targetObject
object
constructorOpt?
Function
Returns
void
Inherited from
Error.captureStackTrace
prepareStackTrace()
Example:
Error.prepareStackTrace = (error, stackTraces) => `${error.name}: ${stackTraces.length} frames`
staticprepareStackTrace(err,stackTraces):any
Defined in: node_modules/.pnpm/@types+node@24.12.2/node_modules/@types/node/globals.d.ts:56
Parameters
err
Error
stackTraces
CallSite[]
Returns
any
See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Inherited from
Error.prepareStackTrace
