Skip to content
Discussion options

You must be logged in to vote

Error codes:

Status Meaning What to do
400 Bad request (missing/invalid params) Check your parameters
401 Invalid or missing API key Verify your API key
404 Currency code not found Check currency code spelling
429 Rate limit exceeded Implement caching (see below)
500 Server error Retry with exponential backoff

JavaScript error handling:

import { ExchangeRateAPI, ExchangeRateAPIError } from '@exchangerateapi/sdk';

const client = new ExchangeRateAPI({ apiKey: 'era_live_YOUR_KEY' });

try {
  const data = await client.latest();
} catch (err) {
  if (err instanceof ExchangeRateAPIError) {
    if (err.status === 429) {
      console.log('Rate limited, using cache');
    } else 

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by cahthuranag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant