maix.err
maix.err module
You can use
maix.err
to access this module with MaixPy
This module is generated from MaixCDK
Module
No module
Enum
Err
item | doc |
---|---|
brief | Maix Error code |
values | ERR_NONE: No error ERR_ARGS: Invalid arguments ERR_NO_MEM: No memory ERR_NOT_IMPL: Not implemented ERR_NOT_READY: Not ready ERR_NOT_INIT: Not initialized ERR_NOT_OPEN: Not opened ERR_NOT_PERMIT: Not permitted ERR_REOPEN: Re-open ERR_BUSY: Busy ERR_READ: Read error ERR_WRITE: Write error ERR_TIMEOUT: Timeout ERR_RUNTIME: Runtime error ERR_IO: IO error ERR_NOT_FOUND: Not found ERR_ALREAY_EXIST: Already exist ERR_BUFF_FULL: Buffer full ERR_BUFF_EMPTY: Buffer empty ERR_CANCEL: Cancel ERR_OVERFLOW: Overflow ERR_MAX: |
C++ defination code:
enum Err
{
// !!! fixed error code, DO NOT change number already defined, only append new error code
ERR_NONE = 0, // No error
ERR_ARGS , // Invalid arguments
ERR_NO_MEM , // No memory
ERR_NOT_IMPL , // Not implemented
ERR_NOT_READY , // Not ready
ERR_NOT_INIT , // Not initialized
ERR_NOT_OPEN , // Not opened
ERR_NOT_PERMIT , // Not permitted
ERR_REOPEN , // Re-open
ERR_BUSY , // Busy
ERR_READ , // Read error
ERR_WRITE , // Write error
ERR_TIMEOUT , // Timeout
ERR_RUNTIME , // Runtime error
ERR_IO , // IO error
ERR_NOT_FOUND , // Not found
ERR_ALREAY_EXIST , // Already exist
ERR_BUFF_FULL , // Buffer full
ERR_BUFF_EMPTY , // Buffer empty
ERR_CANCEL , // Cancel
ERR_OVERFLOW , // Overflow
ERR_MAX,
}
Variable
Function
to_str
def to_str(e: Err) -> str
item | doc |
---|---|
brief | Error code to string |
param | e: direction [in], error code, err::Err type |
return | error string |
C++ defination code:
std::string to_str(err::Err e)
get_error
def get_error() -> str
item | doc |
---|---|
brief | get last error string |
return | error string |
C++ defination code:
std::string& get_error()
set_error
def set_error(str: str) -> None
item | doc |
---|---|
brief | set last error string |
param | str: direction [in], error string |
C++ defination code:
void set_error(const std::string &str)
check_raise
def check_raise(e: Err, msg: str = '') -> None
item | doc |
---|---|
brief | Check error code, if not ERR_NONE, raise err.Exception |
param | e: direction [in], error code, err::Err type msg: direction [in], error message |
C++ defination code:
void check_raise(err::Err e, const std::string &msg = "")
check_bool_raise
def check_bool_raise(ok: bool, msg: str = '') -> None
item | doc |
---|---|
brief | Check condition, if false, raise err.Exception |
param | ok: direction [in], condition, if true, do nothing, if false, raise err.Exception msg: direction [in], error message |
C++ defination code:
void check_bool_raise(bool ok, const std::string &msg = "")
check_null_raise
def check_null_raise(ptr: capsule, msg: str = '') -> None
item | doc |
---|---|
brief | Check NULL pointer, if NULL, raise exception |
param | ptr: direction [in], pointer msg: direction [in], error message |
C++ defination code:
void check_null_raise(void *ptr, const std::string &msg = "")
Class
Exception
item | doc |
---|---|
brief | Maix Exception |
C++ defination code:
class Exception : public std::exception