@foundry-ai/api-errors
Version:
Common errors that can be thrown and caught reliably across services
27 lines (19 loc) • 975 B
text/typescript
import { suite, test } from 'mocha-typescript';
import { expect } from 'chai';
import { ConflictError } from '../src/conflictError';
class ConflictErrorDefaults {
public error: ConflictError;
before() { this.error = new ConflictError(); }
name() { expect(this.error.name).to.equal('ConflictError'); }
type() { expect(this.error.type).to.equal('conflict_error'); }
message() { expect(this.error.message).to.equal('Conflict'); }
status() { expect(this.error.status).to.equal(409); }
}
class ConflictErrorCustom {
public error: ConflictError;
before() { this.error = new ConflictError('custom message', 999); }
name() { expect(this.error.name).to.equal('ConflictError'); }
type() { expect(this.error.type).to.equal('conflict_error'); }
message() { expect(this.error.message).to.equal('custom message'); }
status() { expect(this.error.status).to.equal(999); }
}