Error handling

Failures surface as NexoFlowError so you can branch on HTTP status, structured codes, and convenience flags.

Example

errors.ts
import { NexoFlow, NexoFlowError } from "nexoflow-sdk"

try {
  const { data } = await nf.posts.get("nonexistent")
} catch (err) {
  if (err instanceof NexoFlowError) {
    console.log(err.status)          // 404
    console.log(err.code)            // "HTTP_404"
    console.log(err.message)         // "Post not found."
    console.log(err.requestId)       // server request ID (if available)
    console.log(err.isNotFound)      // true
    console.log(err.isUnauthorized)  // false
    console.log(err.isRateLimited)   // false
  }
}