4. Error Handling

The following documents possible error codes from method calls when using the Vulnerability Source Module SDK.

Handle errors

Only in case of failure, the json_out parameter of wa_offline_vmod_invoke function will contain the following JSON:

[
{
"code": number,
"detail_code": number,
"description": string
},
...
]

Key

JSON

Description

code

number

The error code with value being defined in wa_offline_vmod_error_codes.h.

detail_code

number

The encoded representation of combination of file name and line of code that the error originates from.

description

string

String description of the error code. Default value is empty.

Available error codes:

Error code has one of the values defined in wa_offline_vmod_error_codes as below:

Define an error when VMod Source is not initialized or did not load database, yet a function is invoked.

#define WA_OFFLINE_VMOD_ERROR_UNINITIALIZED 10

Define an error when the version string provided is invalid.

#define WA_OFFLINE_VMOD_ERROR_VERSION_PARSING 11

Define an error when the product id provided cannot be found in database.

#define WA_OFFLINE_VMOD_ERROR_PRODUCT_ID_NOT_FOUND 12

Define an error when the information queried cannot be found in database.

#define WA_OFFLINE_VMOD_ERROR_INFORMATION_NOT_FOUND 13

Define an error when the input format or value is invalid.

#define WA_OFFLINE_VMOD_ERROR_INVALID_INPUT 14

Define an error when the definition date provided is invalid.

#define WA_OFFLINE_VMOD_ERROR_INVALID_DEF_DATE 15

Define an error when the definition version provided is invalid.

#define WA_OFFLINE_VMOD_ERROR_INVALID_DEF_VERSION 16

Define an error when the engine version provided is invalid.

#define WA_OFFLINE_VMOD_ERROR_INVALID_ENG_VERSION 17

Define an error when the information queried cannot be retrieved because of some internal problem.

#define WA_OFFLINE_VMOD_ERROR_WHILE_PROCESS_QUERY 18

Define an error when the feed queried cannot be found in database.

#define WA_OFFLINE_VMOD_ERROR_FEED_NOT_FOUND 19

Define an error when the product provided cannot be found in database.

#define WA_OFFLINE_VMOD_ERROR_PRODUCT_NOT_FOUND 20

Define an error when one of the sources of vulnerability provided is invalid.

#define WA_OFFLINE_VMOD_ERROR_INVALID_SOURCE 21