Error thrown by ToxBlock operations

ToxBlockError

Example

try {
await toxBlock.checkText(invalidInput);
} catch (error) {
if (error instanceof ToxBlockError) {
console.log('Error code:', error.code);
console.log('Original error:', error.originalError);
}
}

Hierarchy

  • Error
    • ToxBlockError

Constructors

Properties

Constructors

  • Creates a new ToxBlockError instance

    Parameters

    • message: string

      Error message describing what went wrong

    • code: string

      Error code for categorization and handling

    • Optional originalError: Error

      Original error that caused this error (optional)

    Returns ToxBlockError

Properties

code: string

Error code for categorization (e.g., 'INVALID_CONFIG', 'ANALYSIS_FAILED')

originalError: undefined | Error

Original error that caused this error, if any