Skip to main content

Error Handling

This guide covers error handling strategies and best practices for the SatsTerminal Borrow SDK.

Error Types Overview

The SDK provides typed errors for precise handling:

Basic Error Handling

Handling API Errors

API errors include HTTP status codes for precise handling:

Retry Strategies

Automatic Retry Configuration

Manual Retry with Backoff

Workflow Error Handling

Workflows have their own error handling through callbacks:

Session Error Recovery

Global Error Handler

Error Logging

User-Friendly Error Messages

Best Practices

1. Always Catch Errors

2. Use Type Guards

3. Provide Context

4. Don’t Swallow Errors

5. Handle Workflow Errors Separately