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
15namespace 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
#define LS_API
Macros that expands to dllexport, dllimport or nothing on non Windows platforms or in case of static ...
Definition: APIDef.h:22
LSErrorCode
LicenseSpring Error codes enum.
Definition: PODTypes.h:48
@ eLicenseNotFound
License not found.
Definition: PODTypes.h:54
@ eNotEnoughConsumptionError
Consumption license or feature run out of resources.
Definition: PODTypes.h:65
@ eInvalidCredential
Username does not exist or wrong password provided.
Definition: PODTypes.h:70
@ eWatchdogError
Failed to set license watchdog.
Definition: PODTypes.h:94
@ eTrialNotAllowed
Getting trial licenses is restricted by product license policy.
Definition: PODTypes.h:81
@ eFloatingFeatureDeviceNotInUse
Device was never used to check out a floating feature.
Definition: PODTypes.h:99
@ eServerError
Internal server error.
Definition: PODTypes.h:59
@ eInvalidConfirmationCode
Air gap confirmation code is invalid.
Definition: PODTypes.h:95
@ eSSOTokenError
Token for SSO is not valid or expired.
Definition: PODTypes.h:84
@ eInvalidLicenseFeatureError
Feature does not exist or wrong feature type.
Definition: PODTypes.h:74
@ eInvalidLicenseFeatureCode
Feature code not found on license.
Definition: PODTypes.h:97
@ eLicenseSpringInternalError
Internal SDK error, please contact support or try to update SDK.
Definition: PODTypes.h:71
@ eDeviceError
Device from which the call is made is not licensed (Hardware ID mismatch)
Definition: PODTypes.h:60
@ eProductMismatchError
License product code doesn't correspond to configuration product code.
Definition: PODTypes.h:66
@ eClockTamperedError
Detected that system clock has been set back.
Definition: PODTypes.h:69
@ eDeviceBlacklisted
Device has been added to the blacklist by admin on LicenseSpring platform.
Definition: PODTypes.h:79
@ eInvalidOrderIDError
Order with specified ID already exists and ShouldAppend flag set to false.
Definition: PODTypes.h:73
@ eSignatureMismatchError
Server signature is not valid.
Definition: PODTypes.h:67
@ eLicenseNotFloating
The license is not floating.
Definition: PODTypes.h:78
@ eFeatureNotFloating
License feature that should be released is not a floating feature.
Definition: PODTypes.h:98
@ eAuthorizationError
Authorization failed.
Definition: PODTypes.h:87
@ eNetworkTimeoutError
Request to the backend has timed out.
Definition: PODTypes.h:64
@ eRequestDateHeaderInvalid
Request DateTime header is invalid, please set correct date time on target device,...
Definition: PODTypes.h:96
@ eVMDNotAvailable
Windows only, in case VM detection dll not found or tempered.
Definition: PODTypes.h:88
@ eNoInternetError
Problems with Internet connection.
Definition: PODTypes.h:63
@ eLocalLicenseError
SDK could not read or write license to the storage.
Definition: PODTypes.h:68
@ eVMNotAllowed
Running on Virtual machine not allowed.
Definition: PODTypes.h:76
@ eGeneralLSError
General LicenseSpring error.
Definition: PODTypes.h:52
@ eVersionError
App version not found on the backend.
Definition: PODTypes.h:61
@ eActivationFailed
Internal server error.
Definition: PODTypes.h:58
@ ePasswordChangeNotAllowed
Password change is restricted by product policy.
Definition: PODTypes.h:80
@ eFloatingTimeoutExpired
Floating license borrowing period or floating timeout expired.
Definition: PODTypes.h:93
@ eMissingEmailError
Missing email in API call for user-based product, probably attempt to get trial license with empty em...
Definition: PODTypes.h:72
@ eLicenseNoAvailableActivations
The license has already been activated maximum number of times.
Definition: PODTypes.h:75
@ eMaxFloatingReached
Reached max users count for floating license.
Definition: PODTypes.h:77
@ eInitializationError
Invalid Configuration settings.
Definition: PODTypes.h:53
@ eProductError
Product not found on the backend.
Definition: PODTypes.h:62
@ eCannotBeActivatedNow
Current date is behind license start date.
Definition: PODTypes.h:82
@ eUnknownError
Unknown error encountered.
Definition: PODTypes.h:50
@ eSSOError
Customer account not found or SSO is not set up properly.
Definition: PODTypes.h:83
Throws when confirmation code from the air gap activation portal is invalid.
Definition: Exceptions.h:145
AirGapActivationException(const std::string &message)
Definition: Exceptions.h:147
This exception can arise if provided api key cannot be used for the request.
Definition: Exceptions.h:359
ApiKeyException(const std::string &message, LSErrorCode errorCode)
Definition: Exceptions.h:361
Authorization failed, please check your proxy settings.
Definition: Exceptions.h:171
AuthorizationException(const std::string &message)
Definition: Exceptions.h:173
This exception can arise if provided borrowing period bigger than max possible. Or if license borrowi...
Definition: Exceptions.h:351
BorrowLicenseException(const std::string &message, LSErrorCode errorCode)
Definition: Exceptions.h:353
Can be thrown if start date field is set for the license and current date is behind start date.
Definition: Exceptions.h:155
CannotBeActivatedNowException(const std::string &message)
Definition: Exceptions.h:157
This exception means that detected that system clock has been set back.
Definition: Exceptions.h:216
ClockTamperedException(const std::string &message)
Definition: Exceptions.h:218
Throws in case of something wrong with Configuration. E.g. wrong API or Shared key.
Definition: Exceptions.h:52
ConfigurationException(const std::string &message)
Definition: Exceptions.h:54
This exception can arise during license check if device has been blacklisted by Product manager.
Definition: Exceptions.h:316
DeviceBlacklistedException(const std::string &message)
Definition: Exceptions.h:318
Throws in case computer hardware configuration has been changed or license does not belong to this co...
Definition: Exceptions.h:88
DeviceNotLicensedException(const std::string &message)
Definition: Exceptions.h:90
This exception can arise if releasing a device on a non-floating license feature.
Definition: Exceptions.h:392
FeatureNotFloatingException(const std::string &message)
Definition: Exceptions.h:394
This exception can arise if device was never used to check a feature.
Definition: Exceptions.h:400
FloatingFeatureDeviceNotInUseException(const std::string &message)
Definition: Exceptions.h:402
Throws in case floating license timeout or borrowing period is expired and it needs to be registered.
Definition: Exceptions.h:79
FloatingTimeoutExpiredException(const std::string &message)
Definition: Exceptions.h:81
This exception means that user or password is wrong.
Definition: Exceptions.h:225
InvalidCredentialException(const std::string &message)
Definition: Exceptions.h:227
This exception can arise if the given feature code is not found on a license.
Definition: Exceptions.h:384
InvalidLicenseFeatureCodeException(const std::string &message)
Definition: Exceptions.h:386
Throws when product feature does not exist or wrong feature type.
Definition: Exceptions.h:252
InvalidLicenseFeatureException(const std::string &message)
Definition: Exceptions.h:254
Throws when order with specified ID already exists and ShouldAppend flag set to false.
Definition: Exceptions.h:243
InvalidOrderIDException(const std::string &message)
Definition: Exceptions.h:245
Rare exception, can arise if activation is limited to some device count or license transfer is prohib...
Definition: Exceptions.h:127
LicenseActivationException(const std::string &message)
Definition: Exceptions.h:129
Throws when license has already been activated maximum number of times.
Definition: Exceptions.h:136
LicenseNoAvailableActivationsException(const std::string &message)
Definition: Exceptions.h:138
This exception can arise during floating license registration on floating server.
Definition: Exceptions.h:307
LicenseNotFloatingException(const std::string &message)
Definition: Exceptions.h:309
Throws in case license not found on the server.
Definition: Exceptions.h:97
LicenseNotFoundException(const std::string &message)
Definition: Exceptions.h:99
Indicates internal server error, please contact support if you face this exception.
Definition: Exceptions.h:163
LicenseServerException(const std::string &message)
Definition: Exceptions.h:165
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:261
LicenseSpringInternalException(const std::string &message)
Definition: Exceptions.h:263
Throws in case license is in invalid state (disabled, epired or inactive).
Definition: Exceptions.h:70
LicenseStateException(const std::string &message, LSErrorCode errorCode)
Definition: Exceptions.h:72
This exception means that SDK could not read or write license to the storage.
Definition: Exceptions.h:207
LocalLicenseException(const std::string &message)
Definition: Exceptions.h:209
This exception can arise during online check of floating license if reached maximum users count for t...
Definition: Exceptions.h:298
MaxFloatingReachedException(const std::string &message)
Definition: Exceptions.h:300
Throws when email is missing in API call for user-based product, probably attempt to get trial licens...
Definition: Exceptions.h:234
MissingEmailException(const std::string &message)
Definition: Exceptions.h:236
This exception means that network operation timed out.
Definition: Exceptions.h:43
NetworkTimeoutException(const std::string &message)
Definition: Exceptions.h:45
This exception means that SDK cannot reach the server. Because of no internet connection,...
Definition: Exceptions.h:33
NoInternetException(const std::string &message)
Definition: Exceptions.h:35
This exceptions means that Consumption license or feature ran out of resources.
Definition: Exceptions.h:180
NotEnoughConsumptionException(const std::string &message)
Definition: Exceptions.h:182
This exception can arise if password change is restricted by company policy.
Definition: Exceptions.h:325
PasswordChangeNotAllowedException(const std::string &message)
Definition: Exceptions.h:327
This exceptions means that license product code doesn't correspond to configuration product code.
Definition: Exceptions.h:189
ProductMismatchException(const std::string &message)
Definition: Exceptions.h:191
Throws in case product not found on the server.
Definition: Exceptions.h:106
ProductNotFoundException(const std::string &message)
Definition: Exceptions.h:108
Throws in case installation file not found for requested app version.
Definition: Exceptions.h:115
ProductVersionException(const std::string &message)
Definition: Exceptions.h:117
This exception can arise if system date time on the current device is incorrectly set.
Definition: Exceptions.h:376
RequestDateInvalidException(const std::string &message)
Definition: Exceptions.h:378
This exception can arise if the backend cannot create URL for Single sign-on (SSO)
Definition: Exceptions.h:334
SSOException(const std::string &message)
Definition: Exceptions.h:336
This exception can arise if token for Single sign-on (SSO) is invalid or expired.
Definition: Exceptions.h:342
SSOTokenException(const std::string &message)
Definition: Exceptions.h:344
Throws in case signature returned by LicenseSpring server is not valid.
Definition: Exceptions.h:198
SignatureMismatchException(const std::string &message)
Definition: Exceptions.h:200
Can be thrown in case getting trial licenses is restricted by product license policy.
Definition: Exceptions.h:61
TrialNotAllowedException(const std::string &message)
Definition: Exceptions.h:63
In case LicenseSpring backend returns unexpected error or something went wrong.
Definition: Exceptions.h:271
UnknownLicenseSpringException(const std::string &message)
Definition: Exceptions.h:273
Windows only. In case VM detection dll not found, tempered or detection failed.
Definition: Exceptions.h:288
VMDNotAvailableException(const std::string &message)
Definition: Exceptions.h:290
This exception can arise on virtual machine when VM detection is enabled but product policy prohibits...
Definition: Exceptions.h:280
VMIsNotAllowedException(const std::string &message)
Definition: Exceptions.h:282
This exception can arise if setting license watchdog failed.
Definition: Exceptions.h:367
WatchdogException(const std::string &message)
Definition: Exceptions.h:369