Libraries/UPnP/src/include/Network/UPnP/Error.h
Go to the documentation of this file.
1 /****
2  * Error.h
3  *
4  * Copyright 2020 mikee47 <mike@sillyhouse.net>
5  *
6  * This file is part of the Sming UPnP Library
7  *
8  * This library is free software: you can redistribute it and/or modify it under the terms of the
9  * GNU General Public License as published by the Free Software Foundation, version 3 or later.
10  *
11  * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13  * See the GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along with this library.
16  * If not, see <https://www.gnu.org/licenses/>.
17  *
18  ****/
19 
20 #pragma once
21 
22 #include <WString.h>
23 #include "ErrorCode.h"
24 
25 #define UPNP_ERROR_MAP(XX) \
26  XX(Success, "Success") \
27  XX(NoMemory, "Insufficient memory") \
28  XX(XmlParsing, "XML paring failed") \
29  XX(NoSoapBody, "SOAP Body missing") \
30  XX(NoActiveRequest, "No active request") \
31  XX(NoSoapContent, "SOAP content missing") \
32  XX(BadSoapFault, "Unknown SOAP fault kind") \
33  XX(BadSoapNamespace, "Bad SOAP namespace attribute") \
34  XX(ActionInvalid, "Action name not recognised") \
35  XX(ActionNotImplemented, "Action not implemented")
36 
37 namespace UPnP
38 {
40 #define XX(tag, comment) errorValue##tag,
42 #undef XX
43 };
44 
45 enum class Error {
46 #define XX(tag, comment) tag = -errorValue##tag,
48 #undef XX
49  Pending = 1
50 };
51 
56 
57 } // namespace UPnP
58 
59 inline bool operator!(UPnP::Error error)
60 {
61  return int(error) >= 0;
62 }
63 
#define XX(name, comment)
Definition: DirectoryTemplate.h:47
String toLongString(UPnP::Error error)
#define UPNP_ERROR_MAP(XX)
Definition: Libraries/UPnP/src/include/Network/UPnP/Error.h:25
bool operator!(UPnP::Error error)
Definition: Libraries/UPnP/src/include/Network/UPnP/Error.h:59
String toString(UPnP::Error error)
The String class.
Definition: WString.h:137
Definition: ActionRequest.h:25
ErrorCode
Definition: ErrorCode.h:58
ErrorValues
Definition: Libraries/UPnP/src/include/Network/UPnP/Error.h:39
Error
Definition: Libraries/UPnP/src/include/Network/UPnP/Error.h:45
XX(tag, comment)
ErrorCode getErrorCode(Error err)
Get corresponding error code for a given error.