Error Handling

Errors in the JS package will generally be returned in the Promise rejection of the .init() 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."
}
When debugging, we always recommend you also check the Javascript console for any additional details.

If you enable telemetry, any errors will be reported to help us proactively detect and fix any bugs. If you are running into an issue and don't have telemetry enabled, we recommend enabling it so the error can be reported.

Error codes

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

CodeDescriptionHow to fix?
connection_failedCould 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_rejectedUser rejected the World ID request in their WLD app.If this was a mistake, ask the user to go through the flow again.
already_signedThis 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_idThe action ID provided to IDKit is not valid.Check the action ID. Make sure it's a valid string.
invalid_signalThe signal provided to IDKit is not valid.Check the signal. Make sure it's a valid string or address.
unexpected_responseThere 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_errorAn unhandled exception occurred.

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