Skip to content

Commit 33f889d

Browse files
committed
console: Improve gateway error messages
1 parent 376e085 commit 33f889d

1 file changed

Lines changed: 25 additions & 4 deletions

File tree

pkg/webui/lib/errors/utils.js

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -598,12 +598,17 @@ export const ingestError = (error, extras = {}, tags = {}) => {
598598
* @param {object} error - The error object.
599599
* @returns {object|undefined} - The corresponding error message, or undefined if no match.
600600
*/
601+
const qrCodeSuffix = 'Open the Gateway Status page by scanning the QR code on the gateway.'
602+
601603
export const getClaimGatewayErrorMessage = error => {
602604
const m = defineMessages({
603605
notFound: "Gateway doesn't exist. Please confirm that the gateway EUI is correct.",
604-
subscriptionNotActive:
605-
'There is no gateway subscription attached or active. Please get a <link>Gateway Subscription</link> or activate your subscription following the steps in the documentation. If this gateway is part of a fleet, you should use a Fleet Owner Token during the registration process.',
606+
subscriptionDetached: `The gateway billing is detached. ${qrCodeSuffix}`,
607+
subscriptionSuspended: `Your gateway billing is suspended. ${qrCodeSuffix}`,
608+
subscriptionUnknown: `The gateway billing is not set up yet. ${qrCodeSuffix}`,
609+
noSlotsAvailable: `There are no available Gateway Licenses for this gateway. ${qrCodeSuffix}`,
606610
permissionDenied: 'The owner token is invalid.',
611+
fleetIdMismatch: `The gateway EUI matches a Gateway License, but the fleet ID does not match. ${qrCodeSuffix}`,
607612
})
608613

609614
const rootCause = getBackendErrorRootCause(error)
@@ -613,11 +618,27 @@ export const getClaimGatewayErrorMessage = error => {
613618
case 5: // NOT_FOUND
614619
return m.notFound
615620
case 9: // FAILED_PRECONDITION
616-
if (backendErrorMessage.includes('gateway subscription not attached and active')) {
617-
return m.subscriptionNotActive
621+
if (backendErrorMessage.includes('no available slots in gateway fleet')) {
622+
return m.noSlotsAvailable
623+
}
624+
if (backendErrorMessage.includes('gateway subscription is detached')) {
625+
return m.subscriptionDetached
626+
}
627+
628+
if (backendErrorMessage.includes('gateway subscription is suspended')) {
629+
return m.subscriptionSuspended
630+
}
631+
632+
if (backendErrorMessage.includes('gateway subscription is not set')) {
633+
return m.subscriptionUnknown
618634
}
619635
return undefined
620636
case 7: // PERMISSION_DENIED
637+
if (
638+
backendErrorMessage.includes('slot found with the gateway ID, but fleet ID does not match')
639+
) {
640+
return m.fleetIdMismatch
641+
}
621642
return m.permissionDenied
622643
default:
623644
return undefined

0 commit comments

Comments
 (0)