lml-main
Version:
This is now a mono repository published into many standalone packages.
30 lines • 1.03 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/**
* SOMEBODY PLEASE DELETE THIS - IT'S NOW ONLY THE MAP THAT USES IT
*/
const moment = require("moment");
function mkSuccess(value) {
return {
success: true,
value,
};
}
exports.mkSuccess = mkSuccess;
function mkFailure(error) {
return {
success: false,
error: typeof error === 'string'
? error = { message: error }
: Object.assign({ message: error.message, stack: error.stack }, error),
};
}
exports.mkFailure = mkFailure;
function mkHttpError(error, resp, method, path, params) {
// if there is no response status at all then use 523 Origin Is Unreachable response
const status = resp && resp.status ? resp.status : 523;
const message = error && error.message ? JSON.stringify(error.message) : 'Origin Is Unreachable';
return { message, path, params, status, method, time: moment.now() };
}
exports.mkHttpError = mkHttpError;
//# sourceMappingURL=result.js.map