alfresco-ng2-components/docs/core/error-content.component.md
davidcanonieto 70d93805d4 [ADF-2753] New error component (#3336)
* [ADF-1938] Overflowing text in reports section fidex

* [ADF-1938] Long names in report section now fit

* [ADF-1938] Reverted changes in container widget

* [ADF-2753] New error component created

* [ADF-2753] Unit test for Error Content Component

* Deleting unused files

* Deleting unused files

* Deleting unused files

* [ADF-2753] Documentation added

* [ADF-2753] Fixed minor bugs

* [ADF-2753] Authentication not needed to view error

* add error handler

* tslint fix

* router app component

* remove unused import

* fix import modules

* limit to 404

* destroy fixture after any test

* misspelling error
2018-05-19 01:20:49 +01:00

1.8 KiB
Raw Blame History

Error Content Component

Displays info about a specific error.

Basic Usage

Once you have catched the error in your server you will need to redirect to /error/errorCode to display information about that error.

this.router.navigate(['/error', errorCode]);
<div class="adf-error-content">
    <p class="adf-error-content-code">{{ errorCode }}</p>
    <div class="adf-error-content-shadow"></div>
    <p class="adf-error-content-title">{{ errorTitle | translate }}</p>
    <p class="adf-error-content-description">{{ errorDescription | translate }}
        <a href="{{errorLinkUrl}}" *ngIf="errorLinkText" 
        class="adf-error-content-description-link" > {{ errorLinkText | translate }}</a></p>
    <button mat-raised-button color="primary" routerLink="/home">{{ homeButton | translate}}</button>
</div>

Properties

Error Content Component

Name Type Description
errorCode string Error code
errorTitle string Error title
errorDescription string Short description about the error
errorLink string (Optional) This link will be attached at the end of the error description and itt will be highlighted.

Details

You can customize your errors by adding them to the tranlate files inside lib/core/i18n.

"ERROR_CONTENT": {
    "HOME_BUTTON": "Back to home",
    "403": {
      "TITLE": "Error 403 forbidden!",
      "DESCRIPTION": "Sorry, access to this resource on the server is denied. Either check URL or feel free to",
      "LINK": {
        "TEXT": "report this issue.",
        "URL": ""
      }
    },
    "404": {
      "TITLE": "Whoops!",
      "DESCRIPTION": "We couldnt find the page you were looking for.",
      "LINK": {
        "TEXT": "",
        "URL": ""
      }
    }
  }