maix.err

maix.err module

You can use maix.err to access this module with MaixPy
This module is generated from MaixPy and MaixCDK

Module

No module

Enum

Err

Maix Error code

item describe
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

Error code to string

item description
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

get last error string

item description
return error string

C++ defination code:

std::string& get_error()

set_error

def set_error(str: str) -> None

set last error string

item description
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

Check error code, if not ERR_NONE, raise err.Exception

item description
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

Check condition, if false, raise err.Exception

item description
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

Check NULL pointer, if NULL, raise exception

item description
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

Maix Exception

C++ defination code:

class Exception : public std::exception