|
|
@ -14,6 +14,7 @@ import { Observable } from 'rxjs'; |
|
|
import { ErrorComponent } from '../components/errors/error.component'; |
|
|
import { ErrorComponent } from '../components/errors/error.component'; |
|
|
import { Toaster } from '../models/toaster'; |
|
|
import { Toaster } from '../models/toaster'; |
|
|
import { ConfirmationService } from '../services/confirmation.service'; |
|
|
import { ConfirmationService } from '../services/confirmation.service'; |
|
|
|
|
|
import snq from 'snq'; |
|
|
|
|
|
|
|
|
const DEFAULTS = { |
|
|
const DEFAULTS = { |
|
|
defaultError: { |
|
|
defaultError: { |
|
|
@ -50,7 +51,7 @@ export class ErrorHandler { |
|
|
) { |
|
|
) { |
|
|
actions.pipe(ofActionSuccessful(RestOccurError)).subscribe(res => { |
|
|
actions.pipe(ofActionSuccessful(RestOccurError)).subscribe(res => { |
|
|
const { payload: err = {} as HttpErrorResponse | any } = res; |
|
|
const { payload: err = {} as HttpErrorResponse | any } = res; |
|
|
const body = (err as HttpErrorResponse).error.error; |
|
|
const body = snq(() => (err as HttpErrorResponse).error.error, DEFAULTS.defaultError.message); |
|
|
|
|
|
|
|
|
if (err.headers.get('_AbpErrorFormat')) { |
|
|
if (err.headers.get('_AbpErrorFormat')) { |
|
|
const confirmation$ = this.showError(null, null, body); |
|
|
const confirmation$ = this.showError(null, null, body); |
|
|
|