UNPKG

habits-cli

Version:

The habits application seeks to help individuals build up healthy habits.

19 lines (18 loc) 950 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.reportError = void 0; var utils_1 = require("../../utils"); var models_1 = require("../../models"); var reportError = function (error) { var _a, _b, _c, _d; var errorStatus = ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) || "local"; var errorTitle = utils_1.stringParser.capitalize(((_b = error.response) === null || _b === void 0 ? void 0 : _b.statusText) || "An error occurred"); console.log(errorTitle + " (" + errorStatus + ")"); if (!error.response) { throw new models_1.RuntimeError("Could not connect to the server."); } throw (_d = (_c = error.response) === null || _c === void 0 ? void 0 : _c.data.errors) === null || _d === void 0 ? void 0 : _d.map(function (error) { return new models_1.RuntimeError(error.message).withCause(error.cause); }); }; exports.reportError = reportError;