tryError Documentation

Function: createExternalError()
Function

```ts function createExternalError<T>( provider, errorType, message, options? ): ExternalError<T>; ``` Defined in: [factories.ts:523](https://github.com/oconnorjohnson/try-error/blob/e3ae0308069a4fba073f4543d527ad76373db795/src/factories.ts#L523) Pre-built factory for external service errors with validation

tryError API Documentation v0.0.1-alpha.1


tryError API Documentation / createExternalError

Function: createExternalError()

function createExternalError<T>(
  provider,
  errorType,
  message,
  options?
): ExternalError<T>;

Defined in: factories.ts:523

Pre-built factory for external service errors with validation

Type Parameters

T

T extends string

Parameters

provider

string

errorType

T

message

string

options?

ErrorFactoryOptions & { externalId?: string; statusCode?: number; }

Returns

ExternalError<T>

Example

const apiError = createExternalError(
  "stripe",
  "NetworkError",
  "Connection failed",
  {
    statusCode: 500,
    externalId: "req_123",
  }
);