This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
stellar-stellar-2022/sdk/include/util_errors.h

34 lines
918 B
C
Raw Normal View History

2022-07-26 15:05:14 +08:00
/*
**********************************************************************************************
* File: util_errors.h
* Description: different error type
* Authors: Liu WenTan <liuwentan@geedgenetworks.com>
* Date: 2022-07-15
* Copyright: (c) 2018-2022 Geedge Networks, Inc. All rights reserved.
***********************************************************************************************
*/
#define CASE_CODE(E) case E: return #E
/* ST is short for stellar */
typedef enum {
ST_OK = 0,
ST_ERR_MEM_ALLOC,
ST_ERR_RUN_MODE,
ST_ERR_PIO_INSTANCE,
ST_ERR_PIO_DEVICE,
ST_ERR_MAX
} error_code_t;
const char *st_error_to_string(error_code_t err)
{
switch (err) {
CASE_CODE (ST_OK);
CASE_CODE (ST_ERR_MEM_ALLOC);
CASE_CODE (ST_ERR_RUN_MODE);
CASE_CODE (ST_ERR_PIO_INSTANCE);
CASE_CODE (ST_ERR_PIO_DEVICE);
}
return "UNKNOWN_ERROR";
}