-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Log unhandled errors during license activation (no-changelog) (#…
- Loading branch information
Showing
2 changed files
with
12 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,25 +75,29 @@ licenseController.post( | |
} catch (e) { | ||
const error = e as Error & { errorId?: string }; | ||
|
||
let message = 'Failed to activate license'; | ||
|
||
//override specific error messages (to map License Server vocabulary to n8n terms) | ||
switch (error.errorId ?? 'UNSPECIFIED') { | ||
case 'SCHEMA_VALIDATION': | ||
error.message = 'Activation key is in the wrong format'; | ||
message = 'Activation key is in the wrong format'; | ||
break; | ||
case 'RESERVATION_EXHAUSTED': | ||
error.message = | ||
message = | ||
'Activation key has been used too many times. Please contact [email protected] if you would like to extend it'; | ||
break; | ||
case 'RESERVATION_EXPIRED': | ||
error.message = 'Activation key has expired'; | ||
message = 'Activation key has expired'; | ||
break; | ||
case 'NOT_FOUND': | ||
case 'RESERVATION_CONFLICT': | ||
error.message = 'Activation key not found'; | ||
message = 'Activation key not found'; | ||
break; | ||
default: | ||
getLogger().error(message, { stack: error.stack ?? 'n/a' }); | ||
} | ||
|
||
throw new ResponseHelper.BadRequestError(error.message); | ||
throw new ResponseHelper.BadRequestError(message); | ||
} | ||
|
||
// Return the read data, plus the management JWT | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters