{"version":3,"sources":["utils/notify-error-reporter.ts"],"names":["ExtendedApiError","Notify","notifyAndThrowExtendedApiError","error","duration","notify","errorMessage","notifyAndLogStandardApiError","message","console","exceptionType","exceptionMessage","notifyExtendedApiError","logExtendedApiError","devErrorMessage","logStandardApiError","standardToExtendedApiReporter","standardErrorReporter","errorDetails","stackTrace","devStackTrace"],"mappings":"OAESA,qBAAwB,2CACxBC,WAAc,cAEjB,SAAUC,+BAA+BC,EAA0BC,EAAmB,KACxF,MAAMC,EAAS,IAAIJ,OAAOG,GAE1B,MADAC,EAAOF,MAAMA,EAAMG,cACb,IAAIN,iBAAiBG,GAGzB,SAAUI,6BAA6BJ,EAA0BC,EAAmB,KACtF,MAAMC,EAAS,IAAIJ,OAAOG,GAC1BC,EAAOF,MAAM,GAAGA,EAAMK,SACtBC,QAAQN,SAASA,EAAMK,oBAAoBL,EAAMO,kBAAkBP,EAAMQ,qBAGvE,SAAUC,uBAAuBT,EAA0BC,EAAmB,KAChF,MAAMC,EAAS,IAAIJ,OAAOG,GAC1BC,EAAOF,MAAM,GAAGA,EAAMG,cAGpB,SAAUO,oBAAoBV,GAChCM,QAAQN,MAAM,IAAGA,EAAMW,iBAA0CX,EAAMG,eAGrE,SAAUS,oBAAoBZ,GAChCM,QAAQN,SAASA,EAAMK,oBAAoBL,EAAMO,kBAAkBP,EAAMQ,qBAGvE,SAAUK,8BAA8BC,GAC1C,OAAO,IACH,IAAMC,EAAe,CACjBV,QAASL,EAAMG,aACfK,iBAAkBR,EAAMW,gBACxBK,WAAYhB,EAAMiB,eAGtBH,EAAsBC,WAjCdhB,+BAMAK,6BAMAK,uBAKAC,oBAIAE,oBAIAC","file":"notify-error-reporter.js","sourcesContent":["import { IStandardApiError } from \"../api/base/i-standard-api-error.js\";\r\nimport { IExtendedApiError } from \"../api/base/i-extended-api-error.js\";\r\nimport { ExtendedApiError } from \"../api/base/extended-api-error.js\";\r\nimport { Notify } from \"./notify.js\";\r\n\r\nexport function notifyAndThrowExtendedApiError(error: IExtendedApiError, duration: number = 8000) {\r\n const notify = new Notify(duration);\r\n notify.error(error.errorMessage);\r\n throw new ExtendedApiError(error);\r\n}\r\n\r\nexport function notifyAndLogStandardApiError(error: IStandardApiError, duration: number = 8000) {\r\n const notify = new Notify(duration);\r\n notify.error(`${error.message}`);\r\n console.error(`${error.message} Details: ${error.exceptionType}. ${error.exceptionMessage}.`);\r\n}\r\n\r\nexport function notifyExtendedApiError(error: IExtendedApiError, duration: number = 8000) {\r\n const notify = new Notify(duration);\r\n notify.error(`${error.errorMessage}`); \r\n}\r\n\r\nexport function logExtendedApiError(error: IExtendedApiError) {\r\n console.error(`${error.devErrorMessage ? error.devErrorMessage : error.errorMessage}`);\r\n}\r\n\r\nexport function logStandardApiError(error: IStandardApiError) {\r\n console.error(`${error.message} Details: ${error.exceptionType}. ${error.exceptionMessage}.`);\r\n}\r\n\r\nexport function standardToExtendedApiReporter(standardErrorReporter: (error: IStandardApiError) => void): (error: IExtendedApiError) => void{\r\n return (error: IExtendedApiError) => {\r\n const errorDetails = {\r\n message: error.errorMessage,\r\n exceptionMessage: error.devErrorMessage,\r\n stackTrace: error.devStackTrace\r\n } as IStandardApiError;\r\n\r\n standardErrorReporter(errorDetails);\r\n }\r\n}\r\n"]}