Руслан Урядинский / libuavcan

Dependents:   UAVCAN UAVCAN_Subscriber

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers uc_error.cpp Source File

uc_error.cpp

00001 /*
00002  * Copyright (C) 2014 Pavel Kirienko <pavel.kirienko@gmail.com>
00003  */
00004 
00005 #include <uavcan/error.hpp>
00006 #include <cassert>
00007 #include <cstdlib>
00008 
00009 #ifndef UAVCAN_EXCEPTIONS
00010 # error UAVCAN_EXCEPTIONS
00011 #endif
00012 
00013 #if UAVCAN_EXCEPTIONS
00014 # include <stdexcept>
00015 #endif
00016 
00017 namespace uavcan
00018 {
00019 
00020 void handleFatalError(const char* msg)
00021 {
00022 #if UAVCAN_EXCEPTIONS
00023     throw std::runtime_error(msg);
00024 #else
00025     (void)msg;
00026     UAVCAN_ASSERT(0);
00027     std::abort();
00028 #endif
00029 }
00030 
00031 }