@foundry-ai/api-errors
Version:
Common errors that can be thrown and caught reliably across services
27 lines (19 loc) • 978 B
text/typescript
import { suite, test } from 'mocha-typescript';
import { expect } from 'chai';
import { NotFoundError } from '../src/notFoundError';
class NotFoundErrorDefaults {
public error: NotFoundError;
before() { this.error = new NotFoundError(); }
name() { expect(this.error.name).to.equal('NotFoundError'); }
type() { expect(this.error.type).to.equal('not_found_error'); }
message() { expect(this.error.message).to.equal('Not Found'); }
status() { expect(this.error.status).to.equal(404); }
}
class NotFoundErrorCustom {
public error: NotFoundError;
before() { this.error = new NotFoundError('custom message', 999); }
name() { expect(this.error.name).to.equal('NotFoundError'); }
type() { expect(this.error.type).to.equal('not_found_error'); }
message() { expect(this.error.message).to.equal('custom message'); }
status() { expect(this.error.status).to.equal(999); }
}