diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2020-07-04 16:58:08 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2020-07-04 17:03:52 +0200 |
commit | 8db5ff97ffe34aa42f71b5c8aebfa0878e5fde89 (patch) | |
tree | 7d5a196d8dd34621bbdb4b80cd4b78d96ecfeb05 /src/messageparser.h | |
parent | d21701afe4230d633ae685ffeee6f5fb5a76f34d (diff) |
Add error message support and reporting on all commands.
Diffstat (limited to 'src/messageparser.h')
-rw-r--r-- | src/messageparser.h | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/messageparser.h b/src/messageparser.h index 218f3a8..030c77b 100644 --- a/src/messageparser.h +++ b/src/messageparser.h @@ -27,13 +27,13 @@ */ #pragma once -#include "message.h" - #include <string> #include <vector> -MessageList parse_msg(std::string msg); -MessageList parse_msg_client(std::string msg); +#include "message.h" + +MessageList parse_msg(std::string msg, struct lws* wsi); +MessageList parse_msg_client(std::string msg, struct lws* wsi); //message_t create_msg(cmd::cmd_t type, node_t node); @@ -52,3 +52,15 @@ message_t create_msg_create_with_attributes(node_t node, message_t create_msg_update(node_t node, const std::string &attr); message_t create_msg_remove(node_t node); message_t create_msg_move(nodeid_t id, nodeid_t to, nodeid_t insertbeforeid); + +//! Create new error message. +//! \param code is the ErrorCode for this error message. +//! \param msg is the error in textural form for easy presentation on the +//! clients. +//! \param wsi is the client id that the error relates to (usually the one +//! that sent the command resulting in the error) +message_t create_msg_error(ErrorCode code, const std::string &msg, + struct lws* wsi); + +//! Convenience function. +message_t create_msg_error(const ErrorMessage &error, struct lws* wsi); |