Error Handling

The Checkin.com Framework comes with a number of pre-configured errors, but you also have the full freedom to customize error messages on your end.

Error messages can be thrown on both regilyDoneCallback and regilyUpdateCallback.

By using error.action you can configure whether the CTA button on the error screen should close the flow or if the user should go back to previous screen. error.action defaults to back but can also be set to close.

📘

Asynchronous error handling

User behavior data has shown that in order to offer the best experience to as many users as possible, error messages are always displayed at the end of relevant chapter instead of straight away

Pre-configured Error Messages

The Checkin.com Framework provides four pre-configured error messages, including localization.

errorNameReason
duplicateUsernameUsername is already taken and user is looped back to the username screen to try another one
duplicateAccountUser already has an account and is prompted to login
unknownUsed for generic technical errors
phoneCodeInvalidThe SMS validation code entered by a user is incorrect. Only relevant if you are using your own SMS send-outs.

Custom Error Messages

In addition to the pre-configured error messages, you can also customize the content of an error message.

A custom error message consists of:

Variable (data type)Definition
error.name (string)Arbitrary value of your choice (but it can not be any of the pre-configured values)
errorMessage (string)The message presented to the user
error.title (string) (optional)A short title/header
error.action (string) (optional)Whether the CTA should close the registration or go back to relevant screen. Accepted values are back (default) and close
Object.defineProperty(window, 'regilyDoneCallback', {
  enumerable: false,
  configurable: false,
  writable: false,
  value: function(data) {
    return new Promise(function (resolve, reject) {

      // Run validation here

      if (accountVerified) {
        resolve()
      } else {
        var errorTitle = "Verification failed"
        var errorMessage = "We couldn't verify your account, please contact us at [email protected]"
        var errorName = "failedVerification"
        var error = new Error(errorMessage)
        error.name = errorName
        error.title = errorTitle
        error.action = 'close' // `back` is the default value of `action` 		property if not specified
        reject(error)
      }
    })
  }
})

📘

Custom errors are not translated

Custom error messages will be displayed without applying any translations. Localization has to be handled in the integration