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