export class ScimError extends Error {
    constructor({ detail, scimType, status, }) {
        super(detail);
        this.name = 'ScimError';
        this.scimType = scimType;
        this.schemas = [
            'urn:ietf:params:scim:api:messages:2.0:Error',
        ];
        this.detail = detail;
        this.status = status.toString();
    }
    // Override the toJSON method to return the desired structure directly
    toJSON() {
        return {
            ...(this.scimType && { scimType: this.scimType }), // only include if defined
            schemas: this.schemas,
            detail: this.detail,
            status: this.status,
        };
    }
}
//# sourceMappingURL=errors.js.map