From 592efd0a2e5c0c46f4cbf0b1107b135ccab55211 Mon Sep 17 00:00:00 2001 From: Scott Lowe Date: Fri, 2 Oct 2020 16:46:09 +0200 Subject: [PATCH] Treat authorization errors as expected Change-type: patch Resolves: #2035 Signed-off-by: Scott Lowe --- lib/errors.ts | 1 + tests/errors.spec.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/errors.ts b/lib/errors.ts index f4da8aca..93570fea 100644 --- a/lib/errors.ts +++ b/lib/errors.ts @@ -148,6 +148,7 @@ const EXPECTED_ERROR_REGEXES = [ /^BalenaDeviceNotFound/, // balena-sdk /^BalenaExpiredToken/, // balena-sdk /^BalenaInvalidDeviceType/, // balena-sdk + /Request error: Unauthorized$/, // balena-sdk /^Missing \d+ required arg/, // oclif parser: RequiredArgsError /Missing required flag/, // oclif parser: RequiredFlagError /^Unexpected argument/, // oclif parser: UnexpectedArgsError diff --git a/tests/errors.spec.ts b/tests/errors.spec.ts index 4f0fa261..1bf9be8c 100644 --- a/tests/errors.spec.ts +++ b/tests/errors.spec.ts @@ -126,6 +126,7 @@ describe('handleError() function', () => { 'must also be provided when using', // oclif 'Expected an integer', // oclif 'Flag --foo expects a value', // oclif + 'BalenaRequestError: Request error: Unauthorized', // sdk ]; messagesToMatch.forEach((message) => {