In order to enable developers to programmatically handle errors, when a error occurs the GrabzIt Java API throws a GrabzItException which contains a error code that directly maps to a error. How each error code maps to an error is indicated in the below table, this avoids the need to parse error messages.
An example of a GrabzItException exception using error codes to determine how to handle a error is shown below.
try { GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret"); grabzIt.URLToImage("https://www.tesla.com"); grabzIt.SaveTo("images/result.jpg"); } catch(GrabzItException e) { if (e.getCode() == ErrorCode.PARAMETERNOURL) { //Please enter a URL } }
Error Value | Description | Code |
---|---|---|
PARAMETERNOURL | URL is missing | 100 |
PARAMETERINVALIDURL | Specified URL is invalid | 101 |
PARAMETERNONEXISTANTURL | Specified URL does not exist | 102 |
PARAMETERMISSINGAPPLICATIONKEY | Application key is missing | 103 |
PARAMETERUNRECOGNISEDAPPLICATIONKEY | Application key is not recognised | 104 |
PARAMETERMISSINGSIGNATURE | Signature is missing | 105 |
PARAMETERINVALIDSIGNATURE | Signature is invalid | 106 |
PARAMETERINVALIDFORMAT | Specified format is invalid | 107 |
PARAMETERINVALIDCOUNTRYCODE | Specified country code is invalid | 108 |
PARAMETERDUPLICATEIDENTIFIER | Specified identifier already exists | 109 |
PARAMETERMATCHINGRECORDNOTFOUND | Matching record not found | 110 |
PARAMETERINVALIDCALLBACKURL | Specified callback URL is invalid | 111 |
PARAMETERNONEXISTANTCALLBACKURL | Callback URL does not exist | 112 |
PARAMETERIMAGEWIDTHTOOLARGE | Specified image width too large | 113 |
PARAMETERIMAGEHEIGHTTOOLARGE | Specified image height too large | 114 |
PARAMETERBROWSERWIDTHTOOLARGE | Specified browser height too large | 115 |
PARAMETERBROWSERHEIGHTTOOLARGE | Specified browser width too large | 116 |
PARAMETERDELAYTOOLARGE | Specified delay too large | 117 |
PARAMETERINVALIDBACKGROUND | Invalid background parameter for PDF | 118 |
PARAMETERINVALIDINCLUDELINKS | Invalid include links parameter for PDF | 119 |
PARAMETERINVALIDINCLUDEOUTLINE | Invalid include outline parameter for PDF | 120 |
PARAMETERINVALIDPAGESIZE | Invalid PDF page size | 121 |
PARAMETERINVALIDPAGEORIENTATION | Invalid page orientation for PDF | 122 |
PARAMETERVERTICALMARGINTOOLARGE | Vertical margin for PDF too large | 123 |
PARAMETERHORIZONTALMARGINTOOLARGE | Horizontal margin for PDF too large | 124 |
PARAMETERINVALIDCOVERURL | Invalid cover URL for PDF | 125 |
PARAMETERNONEXISTANTCOVERURL | Specified cover URL for PDF does not exist | 126 |
PARAMETERMISSINGCOOKIENAME | Missing cookie name | 127 |
PARAMETERMISSINGCOOKIEDOMAIN | Missing cookie domain | 128 |
PARAMETERINVALIDCOOKIENAME | Invalid cookie name | 129 |
PARAMETERINVALIDCOOKIEDOMAIN | Invalid cookie domain | 130 |
PARAMETERINVALIDCOOKIEDELETE | Invalid cookie delete value | 131 |
PARAMETERINVALIDCOOKIEHTTP | Invalid cookie HTTP value | 132 |
PARAMETERINVALIDCOOKIEEXPIRY | Invalid cookie expiry | 133 |
PARAMETERINVALIDCACHEVALUE | Invalid cache value | 134 |
PARAMETERINVALIDDOWNLOADVALUE | Invalid download value | 135 |
PARAMETERINVALIDSUPPRESSVALUE | Invalid suppress value | 136 |
PARAMETERMISSINGWATERMARKIDENTIFIER | Missing watermark identifier | 137 |
PARAMETERINVALIDWATERMARKIDENTIFIER | Invalid watermark identifier | 138 |
PARAMETERINVALIDWATERMARKXPOS | Invalid watermark x position | 139 |
PARAMETERINVALIDWATERMARKYPOS | Invalid watermark y position | 140 |
PARAMETERMISSINGWATERMARKFORMAT | Watermark not found | 141 |
PARAMETERWATERMARKTOOLARGE | Watermark too large | 142 |
PARAMETERMISSINGPARAMETERS | Missing parameters | 143 |
PARAMETERQUALITYTOOLARGE | Quality parameter too large | 144 |
PARAMETERQUALITYTOOSMALL | Quality parameter too small | 145 |
PARAMETERREPEATTOOSMALL | Repeat parameter too small | 149 |
PARAMETERINVALIDREVERSE | Reverse parameter invalid | 150 |
PARAMETERFPSTOOLARGE | Frames per second parameter too large | 151 |
PARAMETERFPSTOOSMALL | Frames per second parameter too small | 152 |
PARAMETERSPEEDTOOFAST | Speed parameter too fast | 153 |
PARAMETERSPEEDTOOSLOW | Speed parameter too slow | 154 |
PARAMETERINVALIDANIMATIONCOMBINATION | The combination of the duration, FPS, width and height parameters is too large | 155 |
PARAMETERSTARTTOOSMALL | Start parameter too small | 156 |
PARAMETERDURATIONTOOSMALL | Duration parameter too small | 157 |
PARAMETERNOHTML | No HTML was specified | 163 |
PARAMETERINVALIDTARGETVALUE | Invalid target specified | 165 |
PARAMETERINVALIDHIDEVALUE | Invalid element to hide specified | 166 |
PARAMETERINVALIDINCLUDEIMAGES | Include links parameter for DOCX | 167 |
PARAMETERINVALIDEXPORTURL | Invalid export URL | 168 |
PARAMETERINVALIDWAITFORVALUE | Invalid wait for specified | 169 |
PARAMETERINVALIDTRANSPARENTVALUE | Invalid transparent specified | 170 |
PARAMETERINVALIDENCRYPTIONKEY | Invalid encryption key specified | 171 |
PARAMETERINVALIDNOADS | Invalid advert value specified | 172 |
PARAMETERINVALIDPROXY | Invalid HTTP proxy settings provided | 173 |
PARAMETERINVALIDNONOTIFY | Invalid cookie notification value specified | 174 |
PARAMETERINVALIDHD | Invalid high definition value specified | 176 |
PARAMETERINVALIDMEDIATYPE | Invalid media type value specified | 177 |
PARAMETERINVALIDPASSWORD | Invalid password value specified | 178 |
PARAMETERINVALIDMERGE | Invalid merge identifier specified | 179 |
PARAMETERINVALIDCLICKVALUE | Invalid CSS selector to click specified | 180 |
NETWORKSERVEROFFLINE | Server offline | 200 |
NETWORKGENERALERROR | General network error | 201 |
NETWORKDDOSATTACK | Distributed Denial of Service attack | 202 |
RENDERINGERROR | General rendering error | 300 |
RENDERINGMISSINGSCREENSHOT | Missing screenshot | 301 |
GENERICERROR | General error | 400 |
UPGRADEREQUIRED | Upgrade required | 500 |
FILESAVEERROR | File save error | 600 |
FILENONEXISTANTPATH | File path does not exist | 601 |