A device detection library that is used natively or by 51Degrees products

Exceptions.hpp

1/* *********************************************************************
2 * This Original Work is copyright of 51 Degrees Mobile Experts Limited.
3 * Copyright 2026 51 Degrees Mobile Experts Limited, Davidson House,
4 * Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
5 *
6 * This Original Work is licensed under the European Union Public Licence
7 * (EUPL) v.1.2 and is subject to its terms as set out below.
8 *
9 * If a copy of the EUPL was not distributed with this file, You can obtain
10 * one at https://opensource.org/licenses/EUPL-1.2.
11 *
12 * The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
13 * amended by the European Commission) shall be deemed incompatible for
14 * the purposes of the Work and the provisions of the compatibility
15 * clause in Article 5 of the EUPL shall not apply.
16 *
17 * If using the Work as, or as part of, a network application, by
18 * including the attribution notice(s) required under Article 5 of the EUPL
19 * in the end user terms of the application under an appropriate heading,
20 * such notice(s) shall fulfill the requirements of that article.
21 * ********************************************************************* */
22
23#ifndef FIFTYONE_DEGREES_EXCEPTIONS_HPP
24#define FIFTYONE_DEGREES_EXCEPTIONS_HPP
25
26#include <string>
27#include <exception>
28#include <stdexcept>
29#include <memory>
30#include "exceptions.h"
31#include "status.h"
32#include "memory.h"
33
34using std::runtime_error;
35using std::string;
36using std::exception;
37using std::shared_ptr;
38
39namespace FiftyoneDegrees {
40 namespace Common {
41 FIFTYONE_DEGREES_COMMON_CXX_BEGIN
45 class StatusCodeException : public exception {
46 public:
52
61 const char *fileName);
62
67
72 const char* what() const noexcept;
73
78
79 protected:
80
85
88
90 string message;
91 };
92
97 public:
103 };
104
110 class NotImplementedException : public runtime_error {
111 public:
116 };
117
123 class InvalidPropertyException : public runtime_error {
124 public:
129
134 InvalidPropertyException(const char *message);
135 };
136
140 class EvidenceException : public runtime_error {
141 public:
146 };
147
154 class TooManyValuesException : public runtime_error {
155 public:
160 };
161
166 class NoValuesAvailableException : public runtime_error {
167 public:
172
177 NoValuesAvailableException(const char *message);
178 };
179 FIFTYONE_DEGREES_COMMON_CXX_END
180 }
181}
182
183#endif
FatalException(fiftyoneDegreesException *exception)
New exception from the C exception structure provided.
InvalidPropertyException(const char *message)
Constructor with error message.
NoValuesAvailableException(const char *message)
Constructor with error message.
~StatusCodeException()
Dispose of the exception instance.
string message
Error message from the status code.
Definition Exceptions.hpp:90
fiftyoneDegreesStatusCode statusCode
Status code.
Definition Exceptions.hpp:87
const char * what() const noexcept
Get the message associated with the exception.
StatusCodeException(fiftyoneDegreesStatusCode code, const char *fileName)
New exception from the status code provided and the file name relating to the operation which failed.
fiftyoneDegreesStatusCode getCode() const noexcept
Get the status code.
StatusCodeException(fiftyoneDegreesStatusCode code)
New exception from the status code provided.
fiftyoneDegreesStatusCode
Status returned from the initialisation of a resource.
Definition status.h:81
Shared classes.
Definition Collection.hpp:31
A C++ wrapper class for transform.h conversion routines.
Definition ComponentMetaDataBuilderHash.hpp:33
Structure used to represent a 51Degrees exception and passed into methods that might generate excepti...
Definition exceptions.h:115