Error Handling

The dataError methods are used to display error messages during the registration

Error messages can be triggered as a response to all setOnComplete and setOnUpdate methods as described in the section on handling user data.

It is recommended to include error handling for all validations you run on your end, as well as for a general error in case something goes wrong when you attempt to store the user account in your backend.

Here is an example of how to respond with a custom error on a setOnUpdate (triggered by a user inputting their email address).

If you can't access a method, make sure you have loaded the SDK correctly.

window.checkin.dataFlow.setOnUpdate((data, dataDiff) => {
  if (dataDiff.credentials && dataDiff.credentials.email) {
    if (dataDiff.credentials.email.startsWith("custom")) {
      return window.checkin.generate.dataError.custom({
        title: "Custom Error Title",
        message: "Custom Message",
        type: "Custom Type",
      });
    }
  }
})

Two types of error messages

The Checkin.com Framework offers both pre-configured error messages as well as customizable error messages.

The pre-configured error messages are already localized and available in all languages supported by the Checkin.com Framework.

📘

Did you know?

User behavior data shows that the likelihood of a customer dropping off decreases if negative feedback is not displayed at once. Error messages in your Checkin.com flow are therefore displayed at the end of each relevant chapter.

Pre-configured Error Messages

Duplicate Account

Generates a pre-defined duplicate account error with the option for the user to log in instead.

window.checkin.generate.dataError.duplicateAccount();

Duplicate Username

Generates a pre-defined error for username taken where the user gets the option to try another one.

window.checkin.generate.dataError.duplicateUsername();

General Error

Generates a pre-defined error message for non-specific errors.

window.checkin.generate.dataError.unknown();

Custom Error Messages

Generates an error message where you can customize the content.

  • title : Is the header of the error screen
  • message : Is the description of the error
  • type : Is your internal error code
  • closeFlow : Specifies if the CTA should be a Close or Back button. This setting is only available on setOnUpdate.
window.checkin.generate.dataError.custom({
  title: "Error title",
  message: "Error message",
  type: "Type",
  closeFlow: true,
});