LicenseSpring C++ SDK  7.31.0
Easily add Software Licensing to your application
Exceptions.h
Go to the documentation of this file.
1 #ifndef LS_EXCEPTIONS_H
2 #define LS_EXCEPTIONS_H
3 
4 #ifdef _MSC_VER
5 #pragma once
6 #pragma warning( push )
7 #pragma warning( disable : 4275 )
8 #endif
9 
10 #include <stdexcept>
11 #include <string>
12 #include "APIDef.h"
13 #include "PODTypes.h"
14 
15 namespace LicenseSpring
16 {
18  class LS_API LicenseSpringException : public std::runtime_error
19  {
20  public:
21  LicenseSpringException( const std::string& message, LSErrorCode errorCode = LSErrorCode::eGeneralLSError )
22  : std::runtime_error( message.c_str() )
23  , m_errorCode( errorCode )
24  {}
25  LSErrorCode getCode() const { return m_errorCode; }
26  protected:
28  };
29 
30 
33  {
34  public:
35  NoInternetException( const std::string& message )
37  };
38 
39 
43  {
44  public:
45  NetworkTimeoutException( const std::string& message )
47  };
48 
49 
52  {
53  public:
54  ConfigurationException( const std::string& message )
56  };
57 
58 
61  {
62  public:
63  TrialNotAllowedException( const std::string& message )
65  };
66 
67 
70  {
71  public:
72  LicenseStateException( const std::string& message, LSErrorCode errorCode )
73  : LicenseSpringException( message, errorCode ) {}
74  };
75 
76 
79  {
80  public:
81  FloatingTimeoutExpiredException( const std::string& message )
83  };
84 
85 
88  {
89  public:
90  DeviceNotLicensedException( const std::string& message )
92  };
93 
94 
97  {
98  public:
99  LicenseNotFoundException( const std::string& message )
101  };
102 
103 
106  {
107  public:
108  ProductNotFoundException( const std::string& message )
110  };
111 
112 
115  {
116  public:
117  ProductVersionException( const std::string& message )
119  };
120 
121 
127  {
128  public:
129  LicenseActivationException( const std::string& message )
131  };
132 
133 
136  {
137  public:
138  LicenseNoAvailableActivationsException( const std::string& message )
139  : LicenseActivationException( message ) { m_errorCode = eLicenseNoAvailableActivations; }
140  };
141 
142 
145  {
146  public:
147  AirGapActivationException( const std::string& message )
148  : LicenseActivationException( message ) { m_errorCode = eInvalidConfirmationCode; }
149  };
150 
151 
155  {
156  public:
157  CannotBeActivatedNowException( const std::string& message )
158  : LicenseActivationException( message ) { m_errorCode = eCannotBeActivatedNow; }
159  };
160 
163  {
164  public:
165  LicenseServerException( const std::string& message )
167  };
168 
171  {
172  public:
173  AuthorizationException( const std::string& message )
175  {}
176  };
177 
180  {
181  public:
182  NotEnoughConsumptionException( const std::string& message )
184  };
185 
186 
189  {
190  public:
191  ProductMismatchException( const std::string& message )
193  };
194 
195 
198  {
199  public:
200  SignatureMismatchException( const std::string& message )
202  };
203 
204 
207  {
208  public:
209  LocalLicenseException( const std::string& message )
211  };
212 
213 
216  {
217  public:
218  ClockTamperedException( const std::string& message )
220  };
221 
222 
225  {
226  public:
227  InvalidCredentialException( const std::string& message )
229  };
230 
231 
234  {
235  public:
236  MissingEmailException( const std::string& message )
238  };
239 
240 
243  {
244  public:
245  InvalidOrderIDException( const std::string& message )
247  };
248 
249 
252  {
253  public:
254  InvalidLicenseFeatureException( const std::string& message )
256  };
257 
258 
261  {
262  public:
263  LicenseSpringInternalException( const std::string& message )
265  };
266 
267 
271  {
272  public:
273  UnknownLicenseSpringException( const std::string& message )
275  };
276 
277 
280  {
281  public:
282  VMIsNotAllowedException( const std::string& message )
284  };
285 
288  {
289  public:
290  VMDNotAvailableException( const std::string& message )
292  {
293  }
294  };
295 
298  {
299  public:
300  MaxFloatingReachedException( const std::string& message )
302  };
303 
304 
307  {
308  public:
309  LicenseNotFloatingException( const std::string& message )
311  };
312 
313 
316  {
317  public:
318  DeviceBlacklistedException( const std::string& message )
320  };
321 
325  {
326  public:
327  PasswordChangeNotAllowedException( const std::string& message )
329  };
330 
334  {
335  public:
336  SSOException( const std::string& message )
338  };
339 
342  {
343  public:
344  SSOTokenException( const std::string& message )
345  : SSOException( message ) { m_errorCode = eSSOTokenError; }
346  };
347 
351  {
352  public:
353  BorrowLicenseException( const std::string& message, LSErrorCode errorCode )
354  : LicenseSpringException( message, errorCode ) {}
355  };
356 
359  {
360  public:
361  ApiKeyException( const std::string& message, LSErrorCode errorCode )
362  : LicenseSpringException( message, errorCode ) {}
363  };
364 
367  {
368  public:
369  WatchdogException( const std::string& message )
371  };
372 
373 
376  {
377  public:
378  RequestDateInvalidException( const std::string& message )
380  };
381 
384  {
385  public:
386  InvalidLicenseFeatureCodeException( const std::string& message )
388  };
389 
392  {
393  public:
394  FeatureNotFloatingException( const std::string& message )
396  };
397 
400  {
401  public:
402  FloatingFeatureDeviceNotInUseException( const std::string& message )
404  };
405 }
406 
407 #ifdef _MSC_VER
408 #pragma warning( pop )
409 #endif
410 
411 #endif // LS_EXCEPTIONS_H
Getting trial licenses is restricted by product license policy.
Definition: PODTypes.h:81
Throws when confirmation code from the air gap activation portal is invalid.
Definition: Exceptions.h:144
DeviceNotLicensedException(const std::string &message)
Definition: Exceptions.h:90
This exception can arise during floating license registration on floating server. ...
Definition: Exceptions.h:306
LSErrorCode
LicenseSpring Error codes enum.
Definition: PODTypes.h:47
Unknown error encountered.
Definition: PODTypes.h:50
UnknownLicenseSpringException(const std::string &message)
Definition: Exceptions.h:273
Request DateTime header is invalid, please set correct date time on target device,.
Definition: PODTypes.h:96
Customer account not found or SSO is not set up properly.
Definition: PODTypes.h:83
Current date is behind license start date.
Definition: PODTypes.h:82
Internal SDK error, please contact support or try to update SDK.
Definition: PODTypes.h:71
ProductMismatchException(const std::string &message)
Definition: Exceptions.h:191
SDK could not read or write license to the storage.
Definition: PODTypes.h:68
Throws in case license not found on the server.
Definition: Exceptions.h:96
LicenseNotFoundException(const std::string &message)
Definition: Exceptions.h:99
Server signature is not valid.
Definition: PODTypes.h:67
ApiKeyException(const std::string &message, LSErrorCode errorCode)
Definition: Exceptions.h:361
This exception can arise if provided borrowing period bigger than max possible. Or if license borrowi...
Definition: Exceptions.h:350
Air gap confirmation code is invalid.
Definition: PODTypes.h:95
This exception means that network operation timed out.
Definition: Exceptions.h:42
License feature that should be released is not a floating feature.
Definition: PODTypes.h:98
ProductVersionException(const std::string &message)
Definition: Exceptions.h:117
This exceptions means that license product code doesn&#39;t correspond to configuration product code...
Definition: Exceptions.h:188
The license has already been activated maximum number of times.
Definition: PODTypes.h:75
Internal server error.
Definition: PODTypes.h:58
License not found.
Definition: PODTypes.h:54
Username does not exist or wrong password provided.
Definition: PODTypes.h:70
In case LicenseSpring backend returns unexpected error or something went wrong.
Definition: Exceptions.h:270
This exception means that user or password is wrong.
Definition: Exceptions.h:224
Order with specified ID already exists and ShouldAppend flag set to false.
Definition: PODTypes.h:73
Floating license borrowing period or floating timeout expired.
Definition: PODTypes.h:93
InvalidLicenseFeatureException(const std::string &message)
Definition: Exceptions.h:254
Problems with Internet connection.
Definition: PODTypes.h:63
LicenseNoAvailableActivationsException(const std::string &message)
Definition: Exceptions.h:138
MissingEmailException(const std::string &message)
Definition: Exceptions.h:236
Throws in case computer hardware configuration has been changed or license does not belong to this co...
Definition: Exceptions.h:87
InvalidCredentialException(const std::string &message)
Definition: Exceptions.h:227
Detected that system clock has been set back.
Definition: PODTypes.h:69
LicenseSpringInternalException(const std::string &message)
Definition: Exceptions.h:263
Windows only. In case VM detection dll not found, tempered or detection failed.
Definition: Exceptions.h:287
SignatureMismatchException(const std::string &message)
Definition: Exceptions.h:200
Missing email in API call for user-based product, probably attempt to get trial license with empty em...
Definition: PODTypes.h:72
Request to the backend has timed out.
Definition: PODTypes.h:64
MaxFloatingReachedException(const std::string &message)
Definition: Exceptions.h:300
Throws in case license is in invalid state (disabled, epired or inactive).
Definition: Exceptions.h:69
This exception means that SDK could not read or write license to the storage.
Definition: Exceptions.h:206
Throws when product feature does not exist or wrong feature type.
Definition: Exceptions.h:251
Windows only, in case VM detection dll not found or tempered.
Definition: PODTypes.h:88
Password change is restricted by product policy.
Definition: PODTypes.h:80
Failed to set license watchdog.
Definition: PODTypes.h:94
DeviceBlacklistedException(const std::string &message)
Definition: Exceptions.h:318
Can be thrown if start date field is set for the license and current date is behind start date...
Definition: Exceptions.h:154
This exception means that detected that system clock has been set back.
Definition: Exceptions.h:215
PasswordChangeNotAllowedException(const std::string &message)
Definition: Exceptions.h:327
This exception can arise during online check of floating license if reached maximum users count for t...
Definition: Exceptions.h:297
ConfigurationException(const std::string &message)
Definition: Exceptions.h:54
Device was never used to check out a floating feature.
Definition: PODTypes.h:99
VMDNotAvailableException(const std::string &message)
Definition: Exceptions.h:290
Invalid Configuration settings.
Definition: PODTypes.h:53
Feature code not found on license.
Definition: PODTypes.h:97
This exception can arise if setting license watchdog failed.
Definition: Exceptions.h:366
Device has been added to the blacklist by admin on LicenseSpring platform.
Definition: PODTypes.h:79
LicenseServerException(const std::string &message)
Definition: Exceptions.h:165
VMIsNotAllowedException(const std::string &message)
Definition: Exceptions.h:282
InvalidLicenseFeatureCodeException(const std::string &message)
Definition: Exceptions.h:386
Throws in case signature returned by LicenseSpring server is not valid.
Definition: Exceptions.h:197
Please, contact support or try to update SDK if you got this exception. Normally should never happen...
Definition: Exceptions.h:260
Authorization failed, please check your proxy settings.
Definition: Exceptions.h:170
RequestDateInvalidException(const std::string &message)
Definition: Exceptions.h:378
Reached max users count for floating license.
Definition: PODTypes.h:77
Feature does not exist or wrong feature type.
Definition: PODTypes.h:74
CannotBeActivatedNowException(const std::string &message)
Definition: Exceptions.h:157
ProductNotFoundException(const std::string &message)
Definition: Exceptions.h:108
Base class for all LicenseSpring exceptions.
Definition: Exceptions.h:18
This exception means that SDK cannot reach the server. Because of no internet connection, DNS issues, etc.
Definition: Exceptions.h:32
FloatingTimeoutExpiredException(const std::string &message)
Definition: Exceptions.h:81
Throws when license has already been activated maximum number of times.
Definition: Exceptions.h:135
The license is not floating.
Definition: PODTypes.h:78
AirGapActivationException(const std::string &message)
Definition: Exceptions.h:147
Indicates internal server error, please contact support if you face this exception.
Definition: Exceptions.h:162
This exceptions means that Consumption license or feature ran out of resources.
Definition: Exceptions.h:179
This exception can arise if token for Single sign-on (SSO) is invalid or expired. ...
Definition: Exceptions.h:341
FloatingFeatureDeviceNotInUseException(const std::string &message)
Definition: Exceptions.h:402
TrialNotAllowedException(const std::string &message)
Definition: Exceptions.h:63
LicenseActivationException(const std::string &message)
Definition: Exceptions.h:129
InvalidOrderIDException(const std::string &message)
Definition: Exceptions.h:245
This exception can arise if the given feature code is not found on a license.
Definition: Exceptions.h:383
Throws when order with specified ID already exists and ShouldAppend flag set to false.
Definition: Exceptions.h:242
Throws when email is missing in API call for user-based product, probably attempt to get trial licens...
Definition: Exceptions.h:233
LicenseNotFloatingException(const std::string &message)
Definition: Exceptions.h:309
Can be thrown in case getting trial licenses is restricted by product license policy.
Definition: Exceptions.h:60
This exception can arise if device was never used to check a feature.
Definition: Exceptions.h:399
General LicenseSpring error.
Definition: PODTypes.h:52
This exception can arise on virtual machine when VM detection is enabled but product policy prohibits...
Definition: Exceptions.h:279
Throws in case installation file not found for requested app version.
Definition: Exceptions.h:114
App version not found on the backend.
Definition: PODTypes.h:61
Throws in case of something wrong with Configuration. E.g. wrong API or Shared key.
Definition: Exceptions.h:51
LicenseSpringException(const std::string &message, LSErrorCode errorCode=LSErrorCode::eGeneralLSError)
Definition: Exceptions.h:21
SSOTokenException(const std::string &message)
Definition: Exceptions.h:344
AuthorizationException(const std::string &message)
Definition: Exceptions.h:173
Consumption license or feature run out of resources.
Definition: PODTypes.h:65
SSOException(const std::string &message)
Definition: Exceptions.h:336
NetworkTimeoutException(const std::string &message)
Definition: Exceptions.h:45
FeatureNotFloatingException(const std::string &message)
Definition: Exceptions.h:394
Device from which the call is made is not licensed (Hardware ID mismatch)
Definition: PODTypes.h:60
LicenseStateException(const std::string &message, LSErrorCode errorCode)
Definition: Exceptions.h:72
This exception can arise if the backend cannot create URL for Single sign-on (SSO) ...
Definition: Exceptions.h:333
Throws in case product not found on the server.
Definition: Exceptions.h:105
NoInternetException(const std::string &message)
Definition: Exceptions.h:35
Running on Virtual machine not allowed.
Definition: PODTypes.h:76
License product code doesn&#39;t correspond to configuration product code.
Definition: PODTypes.h:66
Product not found on the backend.
Definition: PODTypes.h:62
BorrowLicenseException(const std::string &message, LSErrorCode errorCode)
Definition: Exceptions.h:353
Token for SSO is not valid or expired.
Definition: PODTypes.h:84
#define LS_API
Macros that expands to dllexport, dllimport or nothing on non Windows platforms or in case of static ...
Definition: APIDef.h:22
Throws in case floating license timeout or borrowing period is expired and it needs to be registered...
Definition: Exceptions.h:78
ClockTamperedException(const std::string &message)
Definition: Exceptions.h:218
Rare exception, can arise if activation is limited to some device count or license transfer is prohib...
Definition: Exceptions.h:126
This exception can arise if password change is restricted by company policy.
Definition: Exceptions.h:324
WatchdogException(const std::string &message)
Definition: Exceptions.h:369
This exception can arise during license check if device has been blacklisted by Product manager...
Definition: Exceptions.h:315
NotEnoughConsumptionException(const std::string &message)
Definition: Exceptions.h:182
This exception can arise if releasing a device on a non-floating license feature. ...
Definition: Exceptions.h:391
This exception can arise if system date time on the current device is incorrectly set...
Definition: Exceptions.h:375
LocalLicenseException(const std::string &message)
Definition: Exceptions.h:209
This exception can arise if provided api key cannot be used for the request.
Definition: Exceptions.h:358
Authorization failed.
Definition: PODTypes.h:87
Internal server error.
Definition: PODTypes.h:59