import {
Terminal49Client,
AuthenticationError,
RateLimitError,
NotFoundError,
} from '@terminal49/sdk';
const client = new Terminal49Client({
apiToken: process.env.T49_API_TOKEN!,
});
try {
await client.containers.get('container-uuid');
} catch (error) {
if (error instanceof AuthenticationError) {
console.error('Invalid API token');
} else if (error instanceof NotFoundError) {
console.error('Container not found');
} else if (error instanceof RateLimitError) {
console.error('Rate limited, retrying in 60s');
await new Promise((resolve) => setTimeout(resolve, 60000));
} else {
throw error;
}
}