UNPKG

@churchapps/helpers

Version:

Library of helper functions not specific to any one ChurchApps project or framework.

34 lines 1.27 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ErrorHelper = void 0; const ApiHelper_1 = require("./ApiHelper"); class ErrorHelper { static getAppData; static customErrorHandler; static init = (getAppData, customErrorHandler) => { ErrorHelper.getAppData = getAppData; ErrorHelper.customErrorHandler = customErrorHandler; }; static logError = (errorType, message, details) => { if (this.getAppData) { const data = this.getAppData(); const log = { application: data.application, errorTime: new Date(), userId: data.userId, churchId: data.churchId, originUrl: data.originUrl, errorType: errorType, message: message, details: details }; if (log.errorType === "401" && log.message.indexOf("/users/login") > -1) return; ApiHelper_1.ApiHelper.postAnonymous("/errors", [log], "MembershipApi"); if (ErrorHelper.customErrorHandler) ErrorHelper.customErrorHandler(log); } }; } exports.ErrorHelper = ErrorHelper; //# sourceMappingURL=ErrorHelper.js.map