index.js
function format(err, options) {
    const error = { message: 'Internal Server Error' };

    options = options || {};

    if (options.exposeErrors || (err.httpStatusCode && err.httpStatusCode < 500)) {
        error.message = err.message;
        if (err.code) error.code = err.code;
        if (err.validation) error.validation = err.validation;
    }

    if (options.exposeErrors) {
        if (err.stack) error.stack = err.stack.split(/\r?\n/);

        if (err.info) {
            Object.keys(err.info).forEach(key => {
                if (!has(error, key) && has(err.info, key)) error[key] = err.info[key];
            });
        }
    }

    return error;
}
function format(err, options) {
    const error = { message: 'Internal Server Error' };

    options = options || {};

    if (options.exposeErrors || (err.httpStatusCode && err.httpStatusCode < 500)) {
        error.message = err.message;
        if (err.code) error.code = err.code;
        if (err.validation) error.validation = err.validation;
    }

    if (options.exposeErrors) {
        if (err.stack) error.stack = err.stack.split(/\r?\n/);

        if (err.info) {
            Object.keys(err.info).forEach(key => {
                if (!has(error, key) && has(err.info, key)) error[key] = err.info[key];
            });
        }
    }

    return error;
}
function format ( err , options ) { const error = { message : 'Internal Server Error' } ; options = options || { } ; if ( options . exposeErrors || ( err . httpStatusCode && err . httpStatusCode < 500 ) ) { error . message = err . message ; if ( err . code ) error . code = err . code ; if ( err . validation ) error . validation = err . validation ; } if ( options . exposeErrors ) { if ( err . stack ) error . stack = err . stack . split ( / \r?\n / ) ; if ( err . info ) { Object . keys ( err . info ) . forEach ( key => { if ( ! has ( error , key ) && has ( err . info , key ) ) error [ key ] = err . info [ key ] ; } ) ; } } return error ; }
Converts an error object to a stringifyable object format for use
in Flora responses.

@param {FloraError} err object
@param {Object=} options
Converts an error object to a stringifyable object format for use in Flora responses .