tryError Documentation

Function: amountError()
Function

```ts function amountError<T>( requestedAmount, availableAmount, errorCode, message, currency ): AmountError<T>; ``` Defined in: [factories.ts:638](https://github.com/oconnorjohnson/try-error/blob/e3ae0308069a4fba073f4543d527ad76373db795/src/factories.ts#L638) IMPROVED: More intuitive amount error factory

tryError API Documentation v0.0.1-alpha.1


tryError API Documentation / amountError

Function: amountError()

function amountError<T>(
  requestedAmount,
  availableAmount,
  errorCode,
  message,
  currency
): AmountError<T>;

Defined in: factories.ts:638

IMPROVED: More intuitive amount error factory

Type Parameters

T

T extends string = "AmountError"

Parameters

requestedAmount

number

availableAmount

number

errorCode

string

message

string

currency

string = "USD"

Returns

AmountError<T>

Example

const error = amountError(
  150,
  100,
  "insufficient",
  "Insufficient funds available"
);