JS Widget

Error Handling

Errors in the JS package will generally be returned in the Promise rejection of the method. In exceptional cases, some errors may be thrown in the Javascript console (though this is mostly for unhandled errors, and is not normal behavior).

The errorResult object that is returned in the Promise rejection has the following structure:

{
  "code": "already_signed",
  "detail": "User has previously signed and submitted proof for this action."
}

Tip

Error codes

The JS package may return any of the following error codes.

Code Description How to fix?
connection_failed Could not establish a connection to the WLD app.

Ask the user to check their internet connection on both devices running your dapp and their WLD app. Additionally, make sure the user has the latest WLD app version.

verification_rejected User rejected the World ID request in their WLD app. If this was a mistake, ask the user to go through the flow again.
already_signed

This person has already submitted a proof for the particular action.

Nothing to do. User cannot submit a request for the same action twice.

invalid_action_id The action ID provided to the JS widget is not valid. Check the action ID. Make sure it's a valid string.
invalid_signal The signal provided to the JS widget is not valid. Check the signal. Make sure it's a valid string or address.
unexpected_response There was a problem with the response obtained from the WLD app.

Check the JS console for further details, though in most cases these will require contacting us to report the bug.

generic_error An unhandled exception occurred.

Check the JS console for further details, though in most cases these will require contacting us to report the bug.