CreOS SDK
The CreOS SDK allows you to interact with Avular robots
 
Loading...
Searching...
No Matches
error.hpp
1// Copyright (C) 2024 Avular Holding B.V. - All Rights Reserved
2// You may use this code under the terms of the Avular
3// Software End-User License Agreement.
4//
5// You should have received a copy of the Avular
6// Software End-User License Agreement license with
7// this file, or download it from: avular.com/eula
8//
9/*****************************************************************************
10 * Created on: 2024 August 21
11 * Author: Robbert-Jan de Jager
12 *
13 * Error message to communicate that contains an error code and a message.
14 ****************************************************************************/
15#pragma once
16
17#include <nlohmann/json.hpp>
18
19namespace creos_messages {
20
24enum class ErrorCode {
25 kUnknown = 0,
26 kSuccess = 1,
27 kTimeout = 2,
28 kTransportError = 3,
29 kInvalidRequest = 4,
30 kNotExecuted = 5,
31};
32
36struct Error {
41
45 std::string message;
46
50 auto operator<=>(const Error& other) const = default;
51};
52
53NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Error, code, message)
54} // namespace creos_messages
The messages that are used in the communication between the agent and the client.
Definition accel.hpp:22
ErrorCode
Error codes that indicate what went wrong.
Definition error.hpp:24
@ kUnknown
Unknown error.
@ kNotExecuted
The request was not executed. Try looking at the message for more information.
@ kInvalidRequest
The request was invalid, probably indicates a bug in the client.
@ kTimeout
The request timed out.
@ kSuccess
Success (no error)
@ kTransportError
There was an error while transporting the message to the other side.
Error message to communicate that contains an error code and a message.
Definition error.hpp:36
std::string message
The error message.
Definition error.hpp:45
ErrorCode code
The error code.
Definition error.hpp:40
auto operator<=>(const Error &other) const =default
Compare two Error messages.