Get a Free Trial

Error Handling with ASP.NET

DownloadTechnical Information
ASP.NET API

In order to enable developers to programmatically handle errors, when a error occurs the GrabzIt ASP.NET 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 = GrabzItClient.Create("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.Code == ErrorCode.ParameterNoURL)
    {
        //Please enter a URL
    }
}

Error Code Lookup

Enum 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
ParameterInvalidSupressValue 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
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