globalplatform
Data Structures | Macros
error.h File Reference
#include "unicode.h"
Include dependency graph for error.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  OPGP_ERROR_STATUS
 

Macros

#define OPGP_ERROR_STATUS_SUCCESS   0
 No error occured.
 
#define OPGP_ERROR_STATUS_FAILURE   1
 An error occurred.
 
#define ERROR_MESSAGE_LENGTH   256
 
#define OPGP_ERROR_CHECK(status)   status.errorStatus
 
#define OPGP_ERROR_CREATE_ERROR(status, code, message)
 
#define OPGP_ERROR_CREATE_NO_ERROR(status)
 
#define OPGP_ERROR_CREATE_NO_ERROR_WITH_CODE(status, code, message)
 

Detailed Description

This file defines error structures and functions.

Macro Definition Documentation

◆ OPGP_ERROR_CHECK

#define OPGP_ERROR_CHECK (   status)    status.errorStatus

Returns non zero if an error happened.

Parameters
statusMust be the OPGP_ERROR_STATUS structure.

◆ OPGP_ERROR_CREATE_ERROR

#define OPGP_ERROR_CREATE_ERROR (   status,
  code,
  message 
)
Value:
status.errorStatus = OPGP_ERROR_STATUS_FAILURE; \
status.errorCode = code; \
_tcsncpy(status.errorMessage, message, ERROR_MESSAGE_LENGTH); status.errorMessage[ERROR_MESSAGE_LENGTH] = _T('\0')

Sets the status in case of an error.

Parameters
statusMust be the OPGP_ERROR_STATUS structure.
codeIs the error code of the failed function.
messageIs the associated error message.

◆ OPGP_ERROR_CREATE_NO_ERROR

#define OPGP_ERROR_CREATE_NO_ERROR (   status)
Value:
status.errorStatus = OPGP_ERROR_STATUS_SUCCESS; status.errorCode = 0; \
_tcsncpy(status.errorMessage, _T("Success"), ERROR_MESSAGE_LENGTH); status.errorMessage[ERROR_MESSAGE_LENGTH] = _T('\0')

Sets the status in case of no error.

Parameters
statusMust be the OPGP_ERROR_STATUS structure.

◆ OPGP_ERROR_CREATE_NO_ERROR_WITH_CODE

#define OPGP_ERROR_CREATE_NO_ERROR_WITH_CODE (   status,
  code,
  message 
)
Value:
status.errorStatus = OPGP_ERROR_STATUS_SUCCESS; \
status.errorCode = code; \
_tcsncpy(status.errorMessage, message, ERROR_MESSAGE_LENGTH); status.errorMessage[ERROR_MESSAGE_LENGTH] = _T('\0')

Sets the status in case of no error but includes a code e.g. for APDU status word codes.

Parameters
statusMust be the OPGP_ERROR_STATUS structure.
codeMust be the error code.
messageIs the associated error message.
OPGP_ERROR_STATUS_SUCCESS
#define OPGP_ERROR_STATUS_SUCCESS
No error occured.
Definition: error.h:35
OPGP_ERROR_STATUS_FAILURE
#define OPGP_ERROR_STATUS_FAILURE
An error occurred.
Definition: error.h:38