| Xavia SDK c++ API 2.1.0 API description of the xavia library

Loading...
Searching...
No Matches
error.h
1#pragma once
2
3#include <exception>
4#include <string>
5
6#include "xmsdk_export.h"
7#include "sensorErrors.h"
8
9 namespace xavia::sdk
10{
17 class XMSDK_EXPORT Exception : public std::exception
18 {
19 public:
20 Exception(const std::wstring& i_message, const SensorError i_type = SensorError::UNKNOWN_ERROR);
21 Exception(const std::string& i_message, const SensorError i_type = SensorError::UNKNOWN_ERROR);
22 virtual ~Exception();
23
27 const char* what() const noexcept override;
28
33 SensorError GetType() const;
34
35 protected:
36 void CreateMessage(std::string userMessage);
37 std::string messageUtf8;
38 SensorError type;
39 };
40}
41
45[[noreturn]] inline void XM_ERROR(const std::string msg)
46{
47 throw xavia::sdk::Exception(msg);
48}
49
53[[noreturn]] inline void XM_ERROR(const std::wstring msg)
54{
55 throw xavia::sdk::Exception(msg);
56}
xavia::sdk::Exception
Exception base class for the Xavia SDK exceptions.
Definition error.h:18
xavia::sdk::Exception::GetType
SensorError GetType() const
Get the type of the exception.
xavia::sdk::Exception::what
const char * what() const noexcept override
return traditional, human readable version of the exception.