tryError Documentation

Function: externalError()
Function

```ts function externalError<T>( service, operation, message, context? ): ExternalError<T>; ``` Defined in: [factories.ts:671](https://github.com/oconnorjohnson/try-error/blob/e3ae0308069a4fba073f4543d527ad76373db795/src/factories.ts#L671) IMPROVED: More intuitive external service error factory

tryError API Documentation v0.0.1-alpha.1


tryError API Documentation / externalError

Function: externalError()

function externalError<T>(
  service,
  operation,
  message,
  context?
): ExternalError<T>;

Defined in: factories.ts:671

IMPROVED: More intuitive external service error factory

Type Parameters

T

T extends string = "ExternalError"

Parameters

service

string

operation

string

message

string

context?

Record<string, unknown> & { externalId?: string; statusCode?: number; }

Returns

ExternalError<T>

Example

const error = externalError("API", "failed", "Service unavailable", {
  transactionId: "tx_123",
  statusCode: 503,
});