--- title: "Troubleshooting" slug: "webview-error-handling" description: "See how the WebView SDK's promise-based error handling works, parameter validation rules, resolve/reject callbacks, and code examples." updated: 2026-12-04T15:19:37Z published: 2026-12-04T15:19:37Z canonical: "academy.insiderone.com/webview-error-handling" --- > ## Documentation Index > Fetch the complete documentation index at: https://academy.insiderone.com/llms.txt > Use this file to discover all available pages before exploring further. # Error Handling The WebView library implements a comprehensive error handling system that operates across both JavaScript and native SDKs. Errors are communicated bi-directionally through a promise-based architecture, ensuring reliable error reporting and recovery. All asynchronous methods return a **Promise** whose "**resolve**" and "**reject**" callbacks are stored and executed when a result is returned successfully, or an error is thrown from the native SDK, respectively. ![](https://cdn.document360.io/c6df4583-da94-4cb2-bb8a-be0cbdd11109/Images/Documentation/Screenshot at Feb 02 18-17-07.png) The library also performs synchronous parameter validation before invoking native code, throwing errors immediately for invalid inputs. Below is an example. ```typescript try {  const user = window.insider.getCurrentUser();  await user.setAge(25.5); // Invalid: must be integer } catch (error) {  console.error(error.message);  // Output: [setAge] Parameter "age" expected to be of type "integer", but got value: 25.5 } ``` Pass a whole number to setAge, such as 25 instead of 25.5. If you pass a fractional value, the WebView library logs a warning and ignores the value without calling the native SDK. ## Parameter validation rules The library validates all parameters before sending them to native SDKs based on the following validation rules. | Type | Validation rules | | --- | --- | | String | Must be a non-empty string | | Integer | Must be a number, and Number.isInteger() returns true | | Double | Must be a number and Number.isFinite() returns true | | Boolean | Must be true or false | | Date | Must be an instance of Date | | Array | Must be a non-empty array with elements matching the specified type | Below is an example. ```typescript // Gender must be one of the allowed values await user.setGender('male');    // ✓ Valid await user.setGender('female');  // ✓ Valid await user.setGender('other');   // ✓ Valid await user.setGender('unknown'); // ✗ Error: not in allowed values ```