# Error pages

Error pages can be divided into business errors and platform errors.

### Platform errors

Platform errors are errors that appear when an error occurs on the application that is handled by the platform by default, e.g. a session expiration error.&#x20;

In the above situation an error page is displayed containing textContent set in the platform configuration **errorPagesConfiguration**

{% hint style="info" %}
The configuration is set globally in the platform. We do not have the ability to update it low-code in the designer. If changes are needed, contact the administrators.
{% endhint %}

\
**Example configuration:**

```xml
<code_default>
    <content>error_page_default-*</content>
</code_default>
<code_serverSessionExpired>
    <content>error_page_serverSessionExpired-*</content>
    <retryButtonAvailable>true</retryButtonAvailable>
    <styleName>spider-night</styleName>
</code_serverSessionExpired>
<code_formLimitExceeded>
    <content>error_page_formLimitExceeded-*</content>
</code_formLimitExceeded>
```

### Business errors

**Business error** is a situation in which a user's action, a system process or an interaction with an external system violates accepted business rules — even though from a technical point of view the operation could be performed.

Examples:

* Attempting to withdraw an amount exceeding available funds.
* Submitting an application with a client's account inactive.
* Accessing the application as an unauthenticated user, even though login is required

#### How to invoke?&#x20;

**Business error** it can be invoked in script services and script validators. It is best to use the method **throwBusinessException** and **getErrorPageDefinitionBuilder**.

Methods that can be called on the context object:

```javascript
context.getErrorPageDefinitionBuilder()
.body(string)
.styleName(string);
.msg(string)
.pageTitle(string)
.pageTitleKey(string)
.sidebarSlot2TextContent(string);
.sidebarSlot2(string);
.sidebarSlot1TextContent(string);
.sidebarSlot1(string);
.retryButtonAvailable(string)
.retryButtonAvailable(boolean);
.logobarTitle(string);
.logobarTitleKey(string)
.logobarDescription(string);
.bodyTextContent(string);
.parameter(String key, String value)
.cause(Throwable cause)
.redirectUrl(string)
.redirectDelayInMillis(string)
.businessFormIdentifier(string)
```

Sample script with descriptions:

```javascript
function callService(context) {
    let option = context.getFirstParameter('option');
 
    if (!option) {
        return []
    }
 
    let builder = context.getErrorPageDefinitionBuilder() //The method prepares the error screen to be displayed
 
    switch (option) {
        case "1": //Error screen that shows the Content artifact 'error_page_default'
            builder.bodyTextContent("error_page_default-*")
            break;
        case "2": //Error screen added using the content provided in body
            builder.body("Default body in the object")
            builder.parameter("type", "error")
            break;
        case "3": //Error screen that shows the Content artifact 'error_page_paymentSessionExpired'
            builder.bodyTextContent("error_page_paymentSessionExpired-*")
            builder.pageTitle("Page title")
            builder.logobarTitle("Logo title")
            builder.retryButtonAvailable(true);
            break;
        default: //Default error screen displayed as a result of a script error
            throw "Script exception"
 
    }
    context.throwBusinessException(builder); // Throwing the error screen with the prepared builder object
 
 
    return [{ 'output': '' }];
}

```
