DeactivateLicense throws exception

If I call DeactivateLicense and the license has reached its deactivation limit, why does LexActivator throw an exception? If it’s going to throw an exception, then what is the use of the LexStatusCodes.LA_E_DEACTIVATION_LIMIT value?

In general, isn’t it better practice to limit exception throwing to situations where there is not a less disruptive alternative? In this case, it seems that returning a well-defined status code would work perfectly well.

I notice that ActivateLicense behaves similarly. Why throw an exception if the activation limit is reached? At least in the case of ActivateLicense, I can determine how many activations are allowed, and try to prevent the exception, but there is no GetLicenseAllowedDeactivations function to let me disable Deactivation if it is going to fail.

I understand throwing the exception for void functions, because there is no status to return. But for any function that already returns a status, forcing the caller to set up a try/catch block that is probably just going to extract the status from the exception and return it is putting undue burden on your users.

Hi,

All the status codes with prefix LA_E_ are thrown as exceptions. That is by design and cannot be changed.

In general, isn’t it better practice to limit exception throwing to situations where there is not a less disruptive alternative? In this case, returning a well-defined status code would work perfectly well.

It is but for applications, not the libraries.