tryError Documentation

Function: createEntityError()
Function

```ts function createEntityError<T>( entityType, entityId, errorType, message, options? ): EntityError<T>; ``` Defined in: [factories.ts:450](https://github.com/oconnorjohnson/try-error/blob/e3ae0308069a4fba073f4543d527ad76373db795/src/factories.ts#L450) Pre-built factory for entity-related errors with validation

tryError API Documentation v0.0.1-alpha.1


tryError API Documentation / createEntityError

Function: createEntityError()

function createEntityError<T>(
  entityType,
  entityId,
  errorType,
  message,
  options?
): EntityError<T>;

Defined in: factories.ts:450

Pre-built factory for entity-related errors with validation

Type Parameters

T

T extends string

Parameters

entityType

string

entityId

string

errorType

T

message

string

options?

ErrorFactoryOptions

Returns

EntityError<T>

Example

const userError = createEntityError(
  "user",
  "user_123",
  "UserNotFound",
  "User not found"
);
const orderError = createEntityError(
  "order",
  "order_456",
  "OrderCancelled",
  "Order was cancelled"
);