# Task Status and Error Reporting

Task status is an integer value which is zero if no error has been detected while processing the task, or a specific non-zero error code otherwise. Negative status values are used for errors, and positive values are reserved for warnings.

An error can be caused by bad parameter values, system fault like memory allocation failure, or can be an internal error self-detected by the software.

Each task descriptor contains the current status of the task. When creating a task object, constructor assigns the VSL_STATUS_OK status to the task. When processing the task afterwards, other routines such as editors of executors can change the task status if an error occurs and write a corresponding error code into the task status field.

Note that at the stage of creating a task or editing its parameters, the set of parameters may be inconsistent. The parameter consistency check is only performed during the task commitment operation which is implicitly invoked before task execution or task copying. If an error is detected at this stage, task execution or task copying is terminated and the task descriptor saves the corresponding error code. Once an error occurs, any further attempts to process that task descriptor will be terminated and the task will keep the same error code.

Normally, every convolution or correlation function (except DeleteTask) returns the status assigned to the task while performing the function operation.

The status codes are given symbolic names defined in the respective header files. For C/C++, these names are defined as macros via #define statements, and for FORTRAN as integer constants via PARAMETER operators.

If there is no error, the VSL_STATUS_OK is returned, which is defined as zero:

`C/C++:`
  `#define, VSL_STATUS_OK 0`
`F90/F95:`
  `INTEGER,PARAMETER:: VSL_STATUS_OK = 0`

In case of an error, a non-zero error code is returned, which signals about the origin of the failure. The following status codes for the convolution/correlation error codes are pre-defined in the header files for both C/C++ and FORTRAN languages.

Convolution/Correlation Status Codes and Messages
Status Code | Message
--- | ---
VSL_CC_ERROR_NOT_IMPLEMENTED, | Requested functionality is not implemented.
VSL_CC_ERROR_ALLOCATION_FAILURE | Memory allocation failure.
VSL_CC_ERROR_BAD_DESCRIPTOR | Task descriptor is corrupted.
VSL_CC_ERROR_SERVICE_FAILURE | A service function has failed.
VSL_CC_ERROR_EDIT_FAILURE | Failure while editing the task.
VSL_CC_ERROR_EDIT_PROHIBITED | You cannot edit this parameter.
VSL_CC_ERROR_COMMIT_FAILURE | Task committment has failed.
VSL_CC_ERROR_COPY_FAILURE | Failure while copying the task.
VSL_CC_ERROR_DELETE_FAILURE | Failure while deleting the task.
VSL_CC_ERROR_BAD_ARGUMENT | Bad argument or task parameter.
VSL_CC_ERROR_JOB | Bad parameter: job.
SL_CC_ERROR_KIND | Bad parameter: kind.
VSL_CC_ERROR_MODE | Bad parameter: mode.
VSL_CC_ERROR_METHOD | Bad parameter: method.
VSL_CC_ERROR_TYPE | Bad parameter: type.
VSL_CC_ERROR_EXTERNAL_PRECISION | Bad parameter: external_precision.
VSL_CC_ERROR_INTERNAL_PRECISION | Bad parameter: internal_precision.
VSL_CC_ERROR_PRECISION | Incompatible external/internal precisions.
VSL_CC_ERROR_DIMS | Bad parameter: dims.
VSL_CC_ERROR_XSHAPE | Bad parameter: xshape.
VSL_CC_ERROR_YSHAPE | Bad parameter: yshape. Callback function for an abstract BRNG returns an invalid number of updated entries in a buffer, that is, < 0 or >nmax.
VSL_CC_ERROR_ZSHAPE | Bad parameter: zshape.
VSL_CC_ERROR_XSTRIDE | Bad parameter: xstride.
VSL_CC_ERROR_YSTRIDE | Bad parameter: ystride.
VSL_CC_ERROR_ZSTRIDE | Bad parameter: zstride.
VSL_CC_ERROR_X | Bad parameter: x.
VSL_CC_ERROR_Y | Bad parameter: y.
VSL_CC_ERROR_Z | Bad parameter: z.
VSL_CC_ERROR_START | Bad parameter: start.
VSL_CC_ERROR_DECIMATION | Bad parameter: decimation.
VSL_CC_ERROR_OTHER | Some other error.

Parent topic: Convolution and Correlation