LicenseSpring C++ SDK
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:
22  const std::string &message, LSErrorCode errorCode = LSErrorCode::eGeneralLSError)
23  : std::runtime_error(message.c_str()), m_errorCode(errorCode)
24  {
25  }
26  LSErrorCode getCode() const { return m_errorCode; }
27 
28 protected:
30 };
31 
35 {
36 public:
37  NoInternetException(const std::string &message)
39  {
40  }
41 };
42 
47 {
48 public:
49  NetworkTimeoutException(const std::string &message)
51  {
52  }
53 };
54 
57 {
58 public:
59  ConfigurationException(const std::string &message)
61  {
62  }
63 };
64 
67 {
68 public:
69  TrialNotAllowedException(const std::string &message)
71  {
72  }
73 };
74 
77 {
78 public:
79  LicenseStateException(const std::string &message, LSErrorCode errorCode)
80  : LicenseSpringException(message, errorCode)
81  {
82  }
83 };
84 
88 {
89 public:
90  FloatingTimeoutExpiredException(const std::string &message)
92  {
93  }
94 };
95 
99 {
100 public:
101  DeviceNotLicensedException(const std::string &message)
103  {
104  }
105 };
106 
109 {
110 public:
111  LicenseNotFoundException(const std::string &message)
113  {
114  }
115 };
116 
119 {
120 public:
121  ProductNotFoundException(const std::string &message)
123  {
124  }
125 };
126 
129 {
130 public:
131  ProductVersionException(const std::string &message)
133  {
134  }
135 };
136 
143 {
144 public:
145  LicenseActivationException(const std::string &message)
147  {
148  }
149 };
150 
153 {
154 public:
155  LicenseNoAvailableActivationsException(const std::string &message)
156  : LicenseActivationException(message)
157  {
158  m_errorCode = eLicenseNoAvailableActivations;
159  }
160 };
161 
164 {
165 public:
166  AirGapActivationException(const std::string &message) : LicenseActivationException(message)
167  {
168  m_errorCode = eInvalidConfirmationCode;
169  }
170 };
171 
176 {
177 public:
178  CannotBeActivatedNowException(const std::string &message) : LicenseActivationException(message)
179  {
180  m_errorCode = eCannotBeActivatedNow;
181  }
182 };
183 
186 {
187 public:
188  LicenseServerException(const std::string &message)
190  {
191  }
192 };
193 
196 {
197 public:
198  AuthorizationException(const std::string &message)
200  {
201  }
202 };
203 
206 {
207 public:
208  NotEnoughConsumptionException(const std::string &message)
210  {
211  }
212 };
213 
217 {
218 public:
219  ProductMismatchException(const std::string &message)
221  {
222  }
223 };
224 
227 {
228 public:
229  SignatureMismatchException(const std::string &message)
231  {
232  }
233 };
234 
237 {
238 public:
239  LocalLicenseException(const std::string &message)
241  {
242  }
243 };
244 
247 {
248 public:
249  ClockTamperedException(const std::string &message)
251  {
252  }
253 };
254 
257 {
258 public:
259  InvalidCredentialException(const std::string &message)
261  {
262  }
263 };
264 
268 {
269 public:
270  MissingEmailException(const std::string &message)
272  {
273  }
274 };
275 
278 {
279 public:
280  InvalidOrderIDException(const std::string &message)
282  {
283  }
284 };
285 
288 {
289 public:
290  InvalidLicenseFeatureException(const std::string &message)
292  {
293  }
294 };
295 
299 {
300 public:
301  LicenseSpringInternalException(const std::string &message)
303  {
304  }
305 };
306 
311 {
312 public:
313  UnknownLicenseSpringException(const std::string &message)
315  {
316  }
317 };
318 
322 {
323 public:
324  VMIsNotAllowedException(const std::string &message)
326  {
327  }
328 };
329 
332 {
333 public:
334  VMDNotAvailableException(const std::string &message)
336  {
337  }
338 };
339 
343 {
344 public:
345  MaxFloatingReachedException(const std::string &message)
347  {
348  }
349 };
350 
353 {
354 public:
355  LicenseNotFloatingException(const std::string &message)
357  {
358  }
359 };
360 
364 {
365 public:
366  DeviceBlacklistedException(const std::string &message)
368  {
369  }
370 };
371 
375 {
376 public:
377  PasswordChangeNotAllowedException(const std::string &message)
379  {
380  }
381 };
382 
387 {
388 public:
389  SSOException(const std::string &message)
391  {
392  }
393 };
394 
397 {
398 public:
399  SSOTokenException(const std::string &message) : SSOException(message)
400  {
401  m_errorCode = eSSOTokenError;
402  }
403 };
404 
408 {
409 public:
410  BorrowLicenseException(const std::string &message, LSErrorCode errorCode)
411  : LicenseSpringException(message, errorCode)
412  {
413  }
414 };
415 
418 {
419 public:
420  ApiKeyException(const std::string &message, LSErrorCode errorCode)
421  : LicenseSpringException(message, errorCode)
422  {
423  }
424 };
425 
428 {
429 public:
430  WatchdogException(const std::string &message)
432  {
433  }
434 };
435 
438 {
439 public:
440  RequestDateInvalidException(const std::string &message)
442  {
443  }
444 };
445 
448 {
449 public:
450  InvalidLicenseFeatureCodeException(const std::string &message)
452  {
453  }
454 };
455 
458 {
459 public:
460  FeatureNotFloatingException(const std::string &message)
462  {
463  }
464 };
465 
468 {
469 public:
470  FloatingFeatureDeviceNotInUseException(const std::string &message)
472  {
473  }
474 };
475 
477 {
478 public:
479  NegativeConsumptionsNotAllowedException(const std::string &message)
481  {
482  }
483 };
484 
488 {
489 public:
490  OAuthException(const std::string &message, LSErrorCode errorCode)
491  : LicenseSpringException(message, errorCode)
492  {
493  }
494 };
495 } // namespace LicenseSpring
496 
497 #ifdef _MSC_VER
498 #pragma warning(pop)
499 #endif
500 
501 #endif // LS_EXCEPTIONS_H
Getting trial licenses is restricted by product license policy.
Definition: PODTypes.h:85
Throws when confirmation code from the air gap activation portal is invalid.
Definition: Exceptions.h:163
DeviceNotLicensedException(const std::string &message)
Definition: Exceptions.h:101
This exception can arise during floating license registration on floating server. ...
Definition: Exceptions.h:352
LSErrorCode
LicenseSpring Error codes enum.
Definition: PODTypes.h:45
Unknown error encountered.
Definition: PODTypes.h:48
UnknownLicenseSpringException(const std::string &message)
Definition: Exceptions.h:313
This exception can arise if OAuth credentials are invalid, or OAuth is required for authentication...
Definition: Exceptions.h:487
Customer account not found or SSO is not set up properly.
Definition: PODTypes.h:87
Current date is behind license start date.
Definition: PODTypes.h:86
ProductMismatchException(const std::string &message)
Definition: Exceptions.h:219
SDK could not read or write license to the storage.
Definition: PODTypes.h:67
Throws in case license not found on the server.
Definition: Exceptions.h:108
LicenseNotFoundException(const std::string &message)
Definition: Exceptions.h:111
Server signature is not valid.
Definition: PODTypes.h:66
ApiKeyException(const std::string &message, LSErrorCode errorCode)
Definition: Exceptions.h:420
This exception can arise if provided borrowing period bigger than max possible. Or if license borrowi...
Definition: Exceptions.h:407
Air gap confirmation code is invalid.
Definition: PODTypes.h:99
This exception means that network operation timed out.
Definition: Exceptions.h:46
License feature that should be released is not a floating feature.
Definition: PODTypes.h:103
ProductVersionException(const std::string &message)
Definition: Exceptions.h:131
This exceptions means that license product code doesn&#39;t correspond to configuration product code...
Definition: Exceptions.h:216
Internal server error.
Definition: PODTypes.h:56
OAuthException(const std::string &message, LSErrorCode errorCode)
Definition: Exceptions.h:490
License not found.
Definition: PODTypes.h:52
Username does not exist or wrong password provided.
Definition: PODTypes.h:69
In case LicenseSpring backend returns unexpected error or something went wrong.
Definition: Exceptions.h:310
This exception means that user or password is wrong.
Definition: Exceptions.h:256
Floating license borrowing period or floating timeout expired.
Definition: PODTypes.h:97
InvalidLicenseFeatureException(const std::string &message)
Definition: Exceptions.h:290
Problems with Internet connection.
Definition: PODTypes.h:61
LicenseNoAvailableActivationsException(const std::string &message)
Definition: Exceptions.h:155
MissingEmailException(const std::string &message)
Definition: Exceptions.h:270
Throws in case computer hardware configuration has been changed or license does not belong to this co...
Definition: Exceptions.h:98
InvalidCredentialException(const std::string &message)
Definition: Exceptions.h:259
Detected that system clock has been set back.
Definition: PODTypes.h:68
LicenseSpringInternalException(const std::string &message)
Definition: Exceptions.h:301
Windows only. In case VM detection dll not found, tempered or detection failed.
Definition: Exceptions.h:331
SignatureMismatchException(const std::string &message)
Definition: Exceptions.h:229
Request to the backend has timed out.
Definition: PODTypes.h:62
MaxFloatingReachedException(const std::string &message)
Definition: Exceptions.h:345
Throws in case license is in invalid state (disabled, epired or inactive).
Definition: Exceptions.h:76
This exception means that SDK could not read or write license to the storage.
Definition: Exceptions.h:236
Throws when product feature does not exist or wrong feature type.
Definition: Exceptions.h:287
Windows only, in case VM detection dll not found or tempered.
Definition: PODTypes.h:92
Password change is restricted by product policy.
Definition: PODTypes.h:84
Failed to set license watchdog.
Definition: PODTypes.h:98
DeviceBlacklistedException(const std::string &message)
Definition: Exceptions.h:366
Can be thrown if start date field is set for the license and current date is behind start date...
Definition: Exceptions.h:175
NegativeConsumptionsNotAllowedException(const std::string &message)
Definition: Exceptions.h:479
This exception means that detected that system clock has been set back.
Definition: Exceptions.h:246
PasswordChangeNotAllowedException(const std::string &message)
Definition: Exceptions.h:377
This exception can arise during online check of floating license if reached maximum users count for t...
Definition: Exceptions.h:342
ConfigurationException(const std::string &message)
Definition: Exceptions.h:59
Device was never used to check out a floating feature.
Definition: PODTypes.h:104
VMDNotAvailableException(const std::string &message)
Definition: Exceptions.h:334
Invalid Configuration settings.
Definition: PODTypes.h:51
Feature code not found on license.
Definition: PODTypes.h:102
This exception can arise if setting license watchdog failed.
Definition: Exceptions.h:427
LicenseServerException(const std::string &message)
Definition: Exceptions.h:188
VMIsNotAllowedException(const std::string &message)
Definition: Exceptions.h:324
InvalidLicenseFeatureCodeException(const std::string &message)
Definition: Exceptions.h:450
Throws in case signature returned by LicenseSpring server is not valid.
Definition: Exceptions.h:226
Please, contact support or try to update SDK if you got this exception. Normally should never happen...
Definition: Exceptions.h:298
Authorization failed, please check your proxy settings.
Definition: Exceptions.h:195
RequestDateInvalidException(const std::string &message)
Definition: Exceptions.h:440
Reached max users count for floating license.
Definition: PODTypes.h:80
Feature does not exist or wrong feature type.
Definition: PODTypes.h:76
CannotBeActivatedNowException(const std::string &message)
Definition: Exceptions.h:178
ProductNotFoundException(const std::string &message)
Definition: Exceptions.h:121
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:34
FloatingTimeoutExpiredException(const std::string &message)
Definition: Exceptions.h:90
Throws when license has already been activated maximum number of times.
Definition: Exceptions.h:152
The license is not floating.
Definition: PODTypes.h:81
AirGapActivationException(const std::string &message)
Definition: Exceptions.h:166
Indicates internal server error, please contact support if you face this exception.
Definition: Exceptions.h:185
This exceptions means that Consumption license or feature ran out of resources.
Definition: Exceptions.h:205
This exception can arise if token for Single sign-on (SSO) is invalid or expired. ...
Definition: Exceptions.h:396
FloatingFeatureDeviceNotInUseException(const std::string &message)
Definition: Exceptions.h:470
TrialNotAllowedException(const std::string &message)
Definition: Exceptions.h:69
LicenseActivationException(const std::string &message)
Definition: Exceptions.h:145
InvalidOrderIDException(const std::string &message)
Definition: Exceptions.h:280
This exception can arise if the given feature code is not found on a license.
Definition: Exceptions.h:447
Throws when order with specified ID already exists and ShouldAppend flag set to false.
Definition: Exceptions.h:277
Throws when email is missing in API call for user-based product, probably attempt to get trial licens...
Definition: Exceptions.h:267
LicenseNotFloatingException(const std::string &message)
Definition: Exceptions.h:355
Can be thrown in case getting trial licenses is restricted by product license policy.
Definition: Exceptions.h:66
This exception can arise if device was never used to check a feature.
Definition: Exceptions.h:467
General LicenseSpring error.
Definition: PODTypes.h:50
This exception can arise on virtual machine when VM detection is enabled but product policy prohibits...
Definition: Exceptions.h:321
Throws in case installation file not found for requested app version.
Definition: Exceptions.h:128
App version not found on the backend.
Definition: PODTypes.h:59
Throws in case of something wrong with Configuration. E.g. wrong API or Shared key.
Definition: Exceptions.h:56
LicenseSpringException(const std::string &message, LSErrorCode errorCode=LSErrorCode::eGeneralLSError)
Definition: Exceptions.h:21
SSOTokenException(const std::string &message)
Definition: Exceptions.h:399
AuthorizationException(const std::string &message)
Definition: Exceptions.h:198
Consumption license or feature run out of resources.
Definition: PODTypes.h:63
SSOException(const std::string &message)
Definition: Exceptions.h:389
NetworkTimeoutException(const std::string &message)
Definition: Exceptions.h:49
FeatureNotFloatingException(const std::string &message)
Definition: Exceptions.h:460
Device from which the call is made is not licensed (Hardware ID mismatch)
Definition: PODTypes.h:58
LicenseStateException(const std::string &message, LSErrorCode errorCode)
Definition: Exceptions.h:79
This exception can arise if the backend cannot create URL for Single sign-on (SSO) ...
Definition: Exceptions.h:386
Throws in case product not found on the server.
Definition: Exceptions.h:118
NoInternetException(const std::string &message)
Definition: Exceptions.h:37
Running on Virtual machine not allowed.
Definition: PODTypes.h:79
Product not found on the backend.
Definition: PODTypes.h:60
BorrowLicenseException(const std::string &message, LSErrorCode errorCode)
Definition: Exceptions.h:410
Token for SSO is not valid or expired.
Definition: PODTypes.h:88
Negative consumptions not allowed.
Definition: PODTypes.h:105
#define LS_API
Definition: APIDef.h:23
Throws in case floating license timeout or borrowing period is expired and it needs to be registered...
Definition: Exceptions.h:87
ClockTamperedException(const std::string &message)
Definition: Exceptions.h:249
Rare exception, can arise if activation is limited to some device count or license transfer is prohib...
Definition: Exceptions.h:142
This exception can arise if password change is restricted by company policy.
Definition: Exceptions.h:374
WatchdogException(const std::string &message)
Definition: Exceptions.h:430
This exception can arise during license check if device has been blacklisted by Product manager...
Definition: Exceptions.h:363
NotEnoughConsumptionException(const std::string &message)
Definition: Exceptions.h:208
This exception can arise if releasing a device on a non-floating license feature. ...
Definition: Exceptions.h:457
This exception can arise if system date time on the current device is incorrectly set...
Definition: Exceptions.h:437
LocalLicenseException(const std::string &message)
Definition: Exceptions.h:239
This exception can arise if provided api key cannot be used for the request.
Definition: Exceptions.h:417
Authorization failed.
Definition: PODTypes.h:91
Internal server error.
Definition: PODTypes.h:57