Fliplet.UI.Toast.error()

Fliplet.UI.Toast.error()

Parse an error object and show a toast with a friendly initial message plus a button that reveals the detailed, more technical error text via Fliplet.UI.Toast.error(). Useful for surfacing data source, network, and API failures to end users without exposing raw stack traces by default.

Usage

Fliplet.UI.Toast.error(error, message)
  • error (Any) Error object to be parsed
  • message (String) An optional initial message to be shown to the user (Default: Unexpected error)
Fliplet.UI.Toast.error(error, options)
  • error (Any) Error object to be parsed
  • options (Object) A mapping of options, with the following supported keys.
    • message (String) An optional initial message to be shown to the user (Default: Unexpected error)
    • label (String) Label for viewing the full error message. (Default: Details)

Examples

Use a Toast notification to manage a data source connection error

// Data Source 0 is not found, and will trigger an error
Fliplet.DataSources.connect(0)
  .then(function (connection) {
    return connection.find();
  })
  .catch(function (error) {
    Fliplet.UI.Toast.error(error, {
      message: 'Error loading data'
    });
  });

Back to Fliplet.UI