/**
 * An error that gives more structured information to callers. Throw inside a handler as
 *
 *   throw new Error(req, 'Something broke', { code: 'SomethingBroke', status: 400 });
 *
 * You can also include a display_message which is intended to be viewed by the end user
 */
export class ServiceError extends Error {
    status;
    code;
    domain;
    display_message;
    log_stack;
    // Additional data TO BE RETURNED TO THE CLIENT
    client_metadata;
    // If true, this shouldn't be logged as an error, but as an info log.
    // This is common when the error needs to go to the client, but should not
    // take up the valuable mental space of an error log.
    expected_error;
    constructor(app, message, spec) {
        super(message);
        this.domain = app.locals.name;
        Object.assign(this, spec);
    }
}
//# sourceMappingURL=error.js.map