From c3585fd5cb92f55bf61d15948fb419b369003bf0 Mon Sep 17 00:00:00 2001 From: Masum ULU <49063256+masumulu28@users.noreply.github.com> Date: Tue, 12 Mar 2024 16:30:47 +0300 Subject: [PATCH] Update HTTP-Error-Handling.md --- docs/en/UI/Angular/HTTP-Error-Handling.md | 35 +++++++---------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/docs/en/UI/Angular/HTTP-Error-Handling.md b/docs/en/UI/Angular/HTTP-Error-Handling.md index c5d97bbe1a..8b4077fb53 100644 --- a/docs/en/UI/Angular/HTTP-Error-Handling.md +++ b/docs/en/UI/Angular/HTTP-Error-Handling.md @@ -1,31 +1,9 @@ # HTTP Error Handling -## Configurations for Errors -ABP offers a configurations for errors handling. You can set these configuration in **`ThemeSharedModule.forRoot()`** method in app.module.ts +### Error Configurations -See the configuration interface; +ABP offers a configurations for errors handling like below -```ts -export type ErrorScreenErrorCodes = 0 | 401 | 403 | 404 | 500; - -export interface HttpErrorConfig { - skipHandledErrorCodes?: ErrorScreenErrorCodes[] | number[]; // - errorScreen?: { - component: Type; - forWhichErrors?: ErrorScreenErrorCodes[]; - hideCloseIcon?: boolean; - }; -} -``` - -- **`ErrorScreenErrorCodes`** The error codes that you can pass to **`skipHandledErrorCodes`** and **`forWhichErrors`**. -- **`skipHandledErrorCodes`** Error codes those you don't want to handle it. -- **`errorScreen`** The screen that you want to show when a route error occurs. - - **`component`** Component that you want to show. - - **`forWhichErrors`** same as **`ErrorScreenErrorCodes`** - - **`hideCloseIcon`** Hides close icon in default ABP component. - -### Example Usage ```ts import { ThemeSharedModule } from '@abp/ng.theme.shared'; import { MyCustomRouteErrorComponent } from './my-custom-route.component'; @@ -37,7 +15,7 @@ import { MyCustomRouteErrorComponent } from './my-custom-route.component'; skipHandledErrorCodes: [403], errorScreen: { forWhichErrors: [404], - component: MyCustomRouteErrorComponent, + component: CustomErrorComponent, hideCloseIcon: false } } @@ -48,6 +26,13 @@ import { MyCustomRouteErrorComponent } from './my-custom-route.component'; export class AppModule {} ``` +- `ErrorScreenErrorCodes` the error codes that you can pass to `skipHandledErrorCodes` and `forWhichErrors`. +- `skipHandledErrorCodes` the error codes those you don't want to handle it. +- `errorScreen` the screen that you want to show when a route error occurs. + - `component` component that you want to show. + - `forWhichErrors` same as `ErrorScreenErrorCodes` + - `hideCloseIcon` hides close icon in default ABP component. + ## Custom HTTP Error Handler When the `RestService` is used, all HTTP errors are reported to the [`HttpErrorReporterService`](./HTTP-Error-Reporter-Service), and then `ErrorHandler`, a service exposed by the `@abp/ng.theme.shared` package automatically handles the errors.