Error Handling

To receive more detailed error messages when something goes wrong, include the filestack_debug.js script along with the main Filestack library.

Syntax

<script src="https://api.filestackapi.com/filestack_debug.js></script>
<script type="text/javascript">

There are two types of errors utilized in the Filestack javascript library:

filepicker.FilepickerException

Exception objects are thrown when a coding error has been made. These are things like forgetting to include your API key, not passing in the right type of argument to a function, etc. You should not have to use try-catch blocks with these, as they are designed to be noticed and fixed before going into production with your code.

filepicker.FPError

FPError objects are the objects passed back to the onError callback functions, and represent situations where something happened that was unexpected such as server timeouts, browser limitations, missing urls, etc. Each one has a unique code that can help you determine the type of error and the appropriate response. With FPerror codes you should be able to build workflows that catch and work around unexpected problems.

Apart from the FPError types specific to each call, there are the following "general" errors, with codes as follows:

onError
General FPError codes

400 Bad parameters were passed to the server. If you turned on security but have not passed in a valid policy or signature, you may receive this error.
403 Invalid request - The policy and/or signature doe not allow you to perform this action. For more information see Security Documentation.