<aside> ℹ️ Complete Error Code List

</aside>

Introduction

This document covers the system static and app dynamic error pages and how they work. The static error page is a non-customizable page that will be shown for lower level errors (e.g. BF server, network, providers errors), and the app dynamic error page is shown for some higher-level errors (e.g. page not found, request timeout, and some FM errors like Invalid Data API token).

Static Error Page

Errors that occur before the app is able to connect to the DB or a site record was not found, for example, will be redirected to a static page that can not be customized. The picture below is an example of the static error page.

Untitled

Dynamic Error Page

The error page can be accessed via the nav slug /error. It will be associated with either a default or custom page. The picture below shows the default error page.

Untitled

Custom error pages

All apps have a system-generated error page that you can override. To override, simply add a page with the reserved nav slug of /error and you can create and customize your own page. Error detail data is saved to the app model as app.error, and can be accessed in the error page. The error object looks like this:

{
	"error": {
		"code": "404",
		"description": "Page Not Found",
		"message": "Page not found for slug: nopage"
	}
}

Known issue: When saving a new _bfsite to LS, we’re saving the default error page, idForm = FR_errorPage, to _bfsite, which won’t use the new custom error page. The current workaround for that is to add the JS function below to ‘onAppLoad’

delete vueapp.$store.state.site.content.layouts.error.formSchema;
var lsData = JSON.parse(window.localStorage.getItem("_bfsite"));
delete lsData.siteJSON.content.layouts.error.formSchema;
window.localStorage.setItem("_bfsite", JSON.stringify(lsData));

Custom error handlers

Besides customizing the error page, you can also customize how all errors are handled and override the default system behavior.

For example, the default ‘Page Not Found’ error would navigate to the /error page but if you would rather show a toaster alert, the following could be added to the App model.

{
	"errorHandlers": [{
        "actions": [{
            "action": "showAlert",
            "function": "action.options.text = action.options.error.message",
            "options": {
                "text": "",
                "title": "Error",
                "type": "error"
            }
        }],
        "codes": ["404"]
    }]
}

As it can be seen above, custom behaviours are added under a reserved global actions key errorHandlers, and that will be an array of objects. Each object having have codes and actions.