From c6717c796e912b13e254fd71beb02066d32be646 Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Wed, 3 Nov 2021 14:53:40 -0700 Subject: [PATCH] chore: use usageError in more places --- lib/commands/cache.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/commands/cache.js b/lib/commands/cache.js index 43f52e4e95e68..587bcbe84ff5d 100644 --- a/lib/commands/cache.js +++ b/lib/commands/cache.js @@ -116,7 +116,7 @@ class Cache extends BaseCommand { case 'ls': return await this.ls(args) default: - throw Object.assign(new Error(this.usage), { code: 'EUSAGE' }) + throw this.usageError(this.usage) } } @@ -168,7 +168,7 @@ class Cache extends BaseCommand { ' npm cache add ...\n' log.silly('cache add', 'args', args) if (args.length === 0) - throw Object.assign(new Error(usage), { code: 'EUSAGE' }) + throw this.usageError(usage) return Promise.all(args.map(spec => { log.silly('cache add', 'spec', spec)