# Error Handling

## Overview

The YieldFi SDK provides specialized error classes for different error scenarios. All errors extend from `SDKError` and include detailed information.

### Error Types

* `SDKError` - Base error class
* `AuthenticationError` - Authentication failures
* `NetworkError` - Network and HTTP errors
* `ValidationError` - Input validation errors
* `ConfigurationError` - SDK configuration errors

### Quick Example

```typescript
import {
  AuthenticationError,
  NetworkError,
  ValidationError,
} from "yieldfi-sdk";

try {
  const vault = await sdk.vault.getVaultByKey("yusd", 1);
} catch (error) {
  if (error instanceof AuthenticationError) {
    console.error("Auth failed:", error.message);
  } else if (error instanceof NetworkError) {
    console.error("Network error:", error.statusCode);
  } else if (error instanceof ValidationError) {
    console.error("Validation error:", error.message);
  }
}
```

### Next Steps

* Error Types - Detailed error type reference
* Best Practices - Error handling best practices


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.yield.fi/earn-with-yieldfi/integration-sdk/error-handling.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
