\r\n

51Degrees Device Detection C/C++  4.4

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 2023 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 
34 using std::runtime_error;
35 using std::string;
36 using std::exception;
37 using std::shared_ptr;
38 
39 namespace FiftyoneDegrees {
40  namespace Common {
44  class StatusCodeException : public exception {
45  public:
51 
60  const char *fileName);
61 
66 
71  const char* what() const noexcept;
72 
76  fiftyoneDegreesStatusCode getCode() const noexcept;
77 
78  protected:
79 
84 
87 
89  string message;
90  };
91 
96  public:
102  };
103 
109  class NotImplementedException : public runtime_error {
110  public:
115  };
116 
122  class InvalidPropertyException : public runtime_error {
123  public:
128 
133  InvalidPropertyException(const char *message);
134  };
135 
139  class EvidenceException : public runtime_error {
140  public:
145  };
146 
153  class TooManyValuesException : public runtime_error {
154  public:
159  };
160 
165  class NoValuesAvailableException : public runtime_error {
166  public:
171 
176  NoValuesAvailableException(const char *message);
177  };
178  }
179 }
180 
181 #endif
fiftyoneDegreesStatusCode
Status returned from the initialisation of a resource.
Definition: status.h:77
const char * what() const noexcept
Get the message associated with the exception.
Exception thrown when a property does not exist in the data set.
Definition: Exceptions.hpp:122
fiftyoneDegreesStatusCode statusCode
Status code.
Definition: Exceptions.hpp:86
Fatal exception meaning the process should be halted.
Definition: Exceptions.hpp:95
51Degrees base namespace.
Definition: ComponentMetaDataBuilderHash.hpp:33
Exception indicating that there were no values in the results for the requested property.
Definition: Exceptions.hpp:165
FatalException(fiftyoneDegreesException *exception)
New exception from the C exception structure provided.
fiftyoneDegreesStatusCode getCode() const noexcept
Get the status code.
Exception indicating that an attempt was made to return a single value type (e.g.
Definition: Exceptions.hpp:153
Structure used to represent a 51Degrees exception and passed into methods that might generate excepti...
Definition: exceptions.h:111
Exception thrown when there is a problem with the evidence provided.
Definition: Exceptions.hpp:139
Exception indicating that the method has not been implemented by the class.
Definition: Exceptions.hpp:109
Exception containing the status code which caused the exception.
Definition: Exceptions.hpp:44
~StatusCodeException()
Dispose of the exception instance.
string message
Error message from the status code.
Definition: Exceptions.hpp:89