@foundry-ai/api-errors
Version:
Common errors that can be thrown and caught reliably across services
27 lines (19 loc) • 998 B
text/typescript
import { suite, test } from 'mocha-typescript';
import { expect } from 'chai';
import { RateLimitError } from '../src/rateLimitError';
class RateLimitErrorDefaults {
public error: RateLimitError;
before() { this.error = new RateLimitError(); }
name() { expect(this.error.name).to.equal('RateLimitError'); }
type() { expect(this.error.type).to.equal('rate_limit_error'); }
message() { expect(this.error.message).to.equal('Too many requests'); }
status() { expect(this.error.status).to.equal(429); }
}
class RateLimitErrorCustom {
public error: RateLimitError;
before() { this.error = new RateLimitError('custom message', 999); }
name() { expect(this.error.name).to.equal('RateLimitError'); }
type() { expect(this.error.type).to.equal('rate_limit_error'); }
message() { expect(this.error.message).to.equal('custom message'); }
status() { expect(this.error.status).to.equal(999); }
}