{
  "version": 3,
  "sources": ["src/app/snackbar.service.ts"],
  "sourcesContent": ["import { HttpErrorResponse } from '@angular/common/http';\r\nimport { Injectable } from '@angular/core';\r\nimport { MatSnackBar } from '@angular/material/snack-bar';\r\nimport { TranslateService } from '@ngx-translate/core';\r\n\r\n@Injectable({\r\n  providedIn: 'root'\r\n})\r\nexport class SnackBarService {\r\n  constructor(private snackBar: MatSnackBar, private translate: TranslateService) { }\r\n\r\n  showUnknownError(error: any): void {\r\n    let message: string | undefined\r\n\r\n    if (typeof error.error === 'string')\r\n      message = error.error\r\n\r\n    // http error\r\n    else if (error instanceof HttpErrorResponse)\r\n      message = error.message\r\n\r\n    // exception with details\r\n    else if (error.error?.exceptionType && error.error.exceptionMessage) {\r\n      message = `${error.error.exceptionType}: ${error.error.exceptionMessage}`\r\n\r\n      if (error.error.stackTrace)\r\n        message += '\\n' + error.error.stackTrace\r\n    }\r\n    // common error message\r\n    else if (error.error?.message)\r\n      message = error.error.message\r\n\r\n    if (error.error?.messageDetail)\r\n      message += ' ' + error.error.messageDetail\r\n\r\n    if (!message)\r\n      message = this.translate.instant('ERROR.UNKNOWN', { error })\r\n\r\n    this.snackBar.open(message!, this.translate.instant('CLOSE'), { panelClass: ['error', 'multiline'] })\r\n  }\r\n}\r\n"],
  "mappings": "yIAQA,IAAaA,GAAe,IAAA,CAAtB,IAAOA,EAAP,MAAOA,CAAe,CAC1BC,YAAoBC,EAA+BC,EAA2B,CAA1D,KAAAD,SAAAA,EAA+B,KAAAC,UAAAA,CAA+B,CAElFC,iBAAiBC,EAAU,CACzB,IAAIC,EAEA,OAAOD,EAAMA,OAAU,SACzBC,EAAUD,EAAMA,MAGTA,aAAiBE,EACxBD,EAAUD,EAAMC,QAGTD,EAAMA,OAAOG,eAAiBH,EAAMA,MAAMI,kBACjDH,EAAU,GAAGD,EAAMA,MAAMG,aAAa,KAAKH,EAAMA,MAAMI,gBAAgB,GAEnEJ,EAAMA,MAAMK,aACdJ,GAAW;EAAOD,EAAMA,MAAMK,aAGzBL,EAAMA,OAAOC,UACpBA,EAAUD,EAAMA,MAAMC,SAEpBD,EAAMA,OAAOM,gBACfL,GAAW,IAAMD,EAAMA,MAAMM,eAE1BL,IACHA,EAAU,KAAKH,UAAUS,QAAQ,gBAAiB,CAAEP,MAAAA,CAAK,CAAE,GAE7D,KAAKH,SAASW,KAAKP,EAAU,KAAKH,UAAUS,QAAQ,OAAO,EAAG,CAAEE,WAAY,CAAC,QAAS,WAAW,CAAC,CAAE,CACtG,yCA/BWd,GAAee,EAAAC,CAAA,EAAAD,EAAAE,CAAA,CAAA,CAAA,wBAAfjB,EAAekB,QAAflB,EAAemB,UAAAC,WAFd,MAAM,CAAA,EAEd,IAAOpB,EAAPqB,SAAOrB,CAAe,GAAA",
  "names": ["SnackBarService", "constructor", "snackBar", "translate", "showUnknownError", "error", "message", "HttpErrorResponse", "exceptionType", "exceptionMessage", "stackTrace", "messageDetail", "instant", "open", "panelClass", "\u0275\u0275inject", "MatSnackBar", "TranslateService", "factory", "\u0275fac", "providedIn", "_SnackBarService"]
}