SDK Errors
SDK errors follow this structure:Common Status Codes
400 Bad Request
The request was invalid. Common causes:- Missing required parameters
- Invalid parameter types or formats
- Parameter validation failures
- Check that all required fields are provided
- Verify parameter types match the TypeScript definitions
- Review validation rules for each field
401 Unauthorized
Authentication failed. Common causes:- Missing API key
- Invalid API key
- Verify your API key is passed correctly to the
PlankProoflyconstructor.
404 Not Found
The requested resource was not found. How to fix:- Verify identifiers (like job IDs) are correct.
429 Too Many Requests
Rate limit exceeded. You’ve made too many requests in a short period. How to fix:- Implement exponential backoff in your retry logic
- Consider upgrading your plan for higher rate limits
API vs Job Errors
There are two types of errors you might encounter:- Request Errors: Thrown immediately when you call a method (e.g., 400 Bad Request, 401 Unauthorized).
- Job Errors: Occur during asynchronous processing. The SDK throws these as well if the job ends in a
failedstatus.
Example Error Handling
Error Handling Best Practices
Use Try/Catch Blocks
Use Try/Catch Blocks
Always wrap SDK calls in try/catch blocks to handle potential errors.
Handle Specific Status Codes
Handle Specific Status Codes
Implement specific handling for 429 (Rate Limit) and 401 (Auth) errors.
Log Error Details
Log Error Details
Log the error message and status code for debugging purposes.
User-Friendly Messages
User-Friendly Messages
Show friendly error messages to your users based on the error type, rather than raw internal error messages.