{"version":3,"sources":["common/notify-error-reporter.ts"],"names":["ExtendedApiError","Notify","throwApiResponseError","error","duration","errorMessage","notifyAndLogStandardApiError","message","console","exceptionType","exceptionMessage","notifyExtendedApiError","logExtendedApiError","devErrorMessage","standardToExtendedApiReporter","standardErrorReporter","errorDetails","stackTrace","devStackTrace"],"mappings":"OAESA,gBAAgF,KAAxD,gEACxBC,MAA2B,KAAb,cAKjB,SAAUC,sBAAsBC,EAA0BC,EAAmB,KAG/E,MAFe,IAAIH,OAAOG,CAAQ,EAC3BD,MAAMA,EAAME,YAAY,EACzB,IAAIL,iBAAiBG,CAAK,CACpC,CAEM,SAAUG,6BAA6BH,EAA0BC,EAAmB,KACvE,IAAIH,OAAOG,CAAQ,EAC3BD,MAAM,GAAGA,EAAMI,OAAS,EAC/BC,QAAQL,SAASA,EAAMI,oBAAoBJ,EAAMM,kBAAkBN,EAAMO,mBAAmB,CAChG,CAEM,SAAUC,uBAAuBR,EAA0BC,EAAmB,KACjE,IAAIH,OAAOG,CAAQ,CACtC,CAEM,SAAUQ,oBAAoBT,GAChCK,QAAQL,MAAM,IAAGA,EAAMU,iBAA0CV,EAAME,aAAc,CACzF,CAEM,SAAUS,8BAA8BC,GAC1C,OAAO,IACH,IAAMC,EAAe,CACjBT,QAASJ,EAAME,aACfK,iBAAkBP,EAAMU,gBACxBI,WAAYd,EAAMe,a,EAGtBH,EAAsBC,CAAY,CACtC,CACJ,QA9BgBd,sBAMAI,6BAMAK,uBAIAC,oBAIAE,6BAUhB","file":"notify-error-reporter.js","sourcesContent":["import { IStandardApiError } from \"../../components-shared/api/base/i-standard-api-error.js\";\r\nimport { IExtendedApiError } from \"../../components-shared/api/base/i-extended-api-error.js\";\r\nimport { ExtendedApiError } from \"../../components-shared/api/base/extended-api-error.js\";\r\nimport { Notify } from \"./notify.js\";\r\n\r\n/**\r\n * Show error message as notification and throw error after that.\r\n */\r\nexport function throwApiResponseError(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}\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 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"]}