feat(core): Add license:info command (#6047)

* feat(core): Add license:info command

* revert changes to start.ts

* revert changes to start.ts

* fix typo
This commit is contained in:
Cornelius Suermann
2023-04-21 17:10:10 +02:00
committed by GitHub
parent 54f99a7d0d
commit ab12d3e327
6 changed files with 72 additions and 39 deletions

View File

@@ -75,6 +75,7 @@ licenseController.post(
} catch (e) {
const error = e as Error & { errorId?: string };
//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';
@@ -92,7 +93,7 @@ licenseController.post(
break;
}
throw new ResponseHelper.BadRequestError((e as Error).message);
throw new ResponseHelper.BadRequestError(error.message);
}
// Return the read data, plus the management JWT
@@ -115,10 +116,12 @@ licenseController.post(
try {
await license.renew();
} catch (e) {
const error = e as Error & { errorId?: string };
// not awaiting so as not to make the endpoint hang
void Container.get(InternalHooks).onLicenseRenewAttempt({ success: false });
if (e instanceof Error) {
throw new ResponseHelper.BadRequestError(e.message);
if (error instanceof Error) {
throw new ResponseHelper.BadRequestError(error.message);
}
}