libuav original

Dependents:   UAVCAN UAVCAN_Subscriber

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers error.hpp Source File

error.hpp

00001 /*
00002  * Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
00003  */
00004 
00005 #ifndef UAVCAN_ERROR_HPP_INCLUDED
00006 #define UAVCAN_ERROR_HPP_INCLUDED
00007 
00008 #include <uavcan/build_config.hpp>
00009 #include <uavcan/std.hpp>
00010 
00011 namespace uavcan
00012 {
00013 namespace
00014 {
00015 /**
00016  * Common error codes.
00017  *
00018  * Functions that return signed integers may also return inverted error codes,
00019  * i.e. returned value should be inverted back to get the actual error code.
00020  *
00021  * Return code 0 (zero) means no error.
00022  *
00023  * @{
00024  */
00025 const int16_t ErrFailure                 = 1;   ///< General failure
00026 const int16_t ErrInvalidParam            = 2;
00027 const int16_t ErrMemory                  = 3;
00028 const int16_t ErrDriver                  = 4;   ///< Platform driver error
00029 const int16_t ErrUnknownDataType         = 5;
00030 const int16_t ErrInvalidMarshalData      = 6;
00031 const int16_t ErrInvalidTransferListener = 7;
00032 const int16_t ErrNotInited               = 8;
00033 const int16_t ErrRecursiveCall           = 9;
00034 const int16_t ErrLogic                   = 10;
00035 const int16_t ErrPassiveMode             = 11;  ///< Operation not permitted in passive mode
00036 const int16_t ErrTransferTooLong         = 12;  ///< Transfer of this length cannot be sent with given transfer type
00037 const int16_t ErrInvalidConfiguration    = 13;
00038 /**
00039  * @}
00040  */
00041 
00042 }
00043 
00044 /**
00045  * Fatal error handler.
00046  * Behavior:
00047  *  - If exceptions are enabled, throws std::runtime_error() with the supplied message text;
00048  *  - If assertions are enabled (see UAVCAN_ASSERT()), aborts execution using zero assertion.
00049  *  - Otherwise aborts execution via std::abort().
00050  */
00051 #if __GNUC__
00052 __attribute__ ((noreturn))
00053 #endif
00054 UAVCAN_EXPORT
00055 // coverity[+kill]
00056 void handleFatalError(const char* msg);
00057 
00058 }
00059 
00060 #endif // UAVCAN_ERROR_HPP_INCLUDED