curl --request GET \
--url https://api.example.com/api/:projectId/errors{
"projectId": "<string>",
"programName": "<string>",
"errors": [
{
"code": 123,
"name": "<string>",
"msg": "<string>"
}
]
}List all custom error codes defined in a program IDL
curl --request GET \
--url https://api.example.com/api/:projectId/errors{
"projectId": "<string>",
"programName": "<string>",
"errors": [
{
"code": 123,
"name": "<string>",
"msg": "<string>"
}
]
}Documentation Index
Fetch the complete documentation index at: https://mintlify.com/berkayoztunc/orquestra/llms.txt
Use this file to discover all available pages before exploring further.
GET /api/:projectId/errors
curl -X GET "https://api.orquestra.so/api/proj_abc123/errors"
{
"projectId": "proj_abc123",
"programName": "token_swap",
"errors": [
{
"code": 6000,
"name": "InsufficientLiquidity",
"msg": "The pool does not have enough liquidity for this swap"
},
{
"code": 6001,
"name": "SlippageExceeded",
"msg": "The actual swap amount is below the minimum specified (slippage protection)"
},
{
"code": 6002,
"name": "PoolPaused",
"msg": "This pool is currently paused and cannot process swaps"
},
{
"code": 6003,
"name": "InvalidFee",
"msg": "Fee must be between 0 and 10000 basis points (0-100%)"
},
{
"code": 6004,
"name": "UnauthorizedAdmin",
"msg": "Only the pool authority can perform this action"
},
{
"code": 6005,
"name": "InvalidTokenMint",
"msg": "Token mint does not match pool configuration"
},
{
"code": 6006,
"name": "ZeroAmount",
"msg": "Amount must be greater than zero"
},
{
"code": 6007,
"name": "MathOverflow",
"msg": "Arithmetic overflow occurred during calculation"
},
{
"code": 6008,
"name": "MinLiquidityNotMet",
"msg": "Initial liquidity is below the minimum required amount"
},
{
"code": 6009,
"name": "ImbalancedDeposit",
"msg": "Token deposit ratio does not match current pool reserves"
},
{
"code": 6010,
"name": "WithdrawalTooLarge",
"msg": "Cannot withdraw more liquidity than you have deposited"
},
{
"code": 6011,
"name": "PoolAlreadyInitialized",
"msg": "This pool has already been initialized"
},
{
"code": 6012,
"name": "InvalidOracle",
"msg": "Oracle price feed is invalid or stale"
}
]
}
import { AnchorError } from '@project-serum/anchor';
try {
await program.methods.swap(amount, minAmountOut)
.accounts({ /* ... */ })
.rpc();
} catch (error) {
if (error instanceof AnchorError) {
switch (error.error.errorCode.number) {
case 6000:
console.error('Insufficient liquidity in pool');
break;
case 6001:
console.error('Slippage tolerance exceeded');
break;
case 6002:
console.error('Pool is currently paused');
break;
default:
console.error('Unknown error:', error.error.errorMessage);
}
}
}
{
"err": {
"InstructionError": [
0,
{
"Custom": 6001
}
]
}
}
class ErrorDecoder {
constructor(errors) {
this.errorMap = new Map(
errors.map(e => [e.code, { name: e.name, msg: e.msg }])
);
}
decode(errorCode) {
return this.errorMap.get(errorCode) || {
name: 'UnknownError',
msg: `Unknown error code: ${errorCode}`
};
}
}
// Fetch errors and create decoder
const response = await fetch('https://api.orquestra.so/api/proj_abc123/errors');
const { errors } = await response.json();
const decoder = new ErrorDecoder(errors);
// Decode an error from transaction
const error = decoder.decode(6001);
console.log(`${error.name}: ${error.msg}`);
// Output: SlippageExceeded: The actual swap amount is below the minimum specified
404 Not Found
{
"error": "Project not found or not public"
}
500 Internal Server Error
{
"error": "Failed to get errors"
}