Skip to content

Commit b590cd0

Browse files
committed
fix: inherit errors from CLIError
this makes them display without the stack trace
1 parent 49657fd commit b590cd0

File tree

3 files changed

+43
-118
lines changed

3 files changed

+43
-118
lines changed

package.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@
55
"author": "Jeff Dickey @jdxcode",
66
"bugs": "https://github.com/heroku/heroku-cli-command/issues",
77
"dependencies": {
8+
"@oclif/errors": "^1.0.3",
89
"cli-ux": "^3.3.26",
910
"debug": "^3.1.0",
1011
"heroku-client": "3.0.6",
1112
"http-call": "^5.1.0",
12-
"netrc-parser": "^3.1.2"
13+
"netrc-parser": "^3.1.3"
1314
},
1415
"devDependencies": {
1516
"@heroku-cli/tslint": "^1.1.4",
16-
"@oclif/command": "^1.4.6",
17+
"@oclif/command": "^1.4.7",
1718
"@oclif/config": "^1.3.62",
18-
"@oclif/errors": "^1.0.3",
19-
"@oclif/tslint": "^1.0.2",
19+
"@oclif/tslint": "^1.1.0",
2020
"@types/ansi-styles": "^2.0.30",
2121
"@types/chai": "^4.1.2",
2222
"@types/mocha": "^5.0.0",
@@ -25,8 +25,7 @@
2525
"@types/proxyquire": "^1.3.28",
2626
"@types/sinon": "^4.3.1",
2727
"chai": "^4.1.2",
28-
"concurrently": "^3.5.1",
29-
"fancy-test": "^1.0.1",
28+
"fancy-test": "^1.0.3",
3029
"mocha": "^5.0.5",
3130
"nock": "9.2.3",
3231
"prettier": "1.11.1",
@@ -52,7 +51,7 @@
5251
"repository": "heroku/heroku-cli-command",
5352
"scripts": {
5453
"build": "rm -rf lib && tsc",
55-
"lint": "concurrently -p command \"tsc -p test --noEmit\" \"tslint -p test -t stylish\"",
54+
"lint": "tsc -p test --noEmit && tslint -p test -t stylish",
5655
"posttest": "yarn run lint",
5756
"prepublishOnly": "yarn run build",
5857
"test": "mocha --forbid-only \"test/**/*.test.ts\""

src/api_client.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as Config from '@oclif/config'
2+
import {CLIError} from '@oclif/errors'
23
import {HTTP, HTTPError, HTTPRequestOptions} from 'http-call'
34
import * as url from 'url'
45

@@ -19,7 +20,7 @@ export interface IHerokuAPIErrorOptions {
1920
url?: string
2021
}
2122

22-
export class HerokuAPIError extends Error {
23+
export class HerokuAPIError extends CLIError {
2324
http: HTTPError
2425
body: IHerokuAPIErrorOptions
2526

yarn.lock

Lines changed: 35 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
version "1.0.0"
1414
resolved "https://registry.yarnpkg.com/@heroku/linewrap/-/linewrap-1.0.0.tgz#a9d4e99f0a3e423a899b775f5f3d6747a1ff15c6"
1515

16-
"@oclif/command@^1.4.6":
17-
version "1.4.6"
18-
resolved "https://registry.yarnpkg.com/@oclif/command/-/command-1.4.6.tgz#6de7789cfc6ae6cdf177566fbfbb742d5cb8f320"
16+
"@oclif/command@^1.4.7":
17+
version "1.4.7"
18+
resolved "https://registry.yarnpkg.com/@oclif/command/-/command-1.4.7.tgz#32423fcb3317c1e9fd5b864c728ddd5e4f8fd361"
1919
dependencies:
2020
"@oclif/errors" "^1.0.3"
2121
"@oclif/parser" "^3.2.9"
@@ -48,11 +48,11 @@
4848
version "1.0.2"
4949
resolved "https://registry.yarnpkg.com/@oclif/screen/-/screen-1.0.2.tgz#c9d7c84b0ea60ecec8dd7a9b22c012ba9967aed8"
5050

51-
"@oclif/tslint@^1.0.2":
52-
version "1.0.2"
53-
resolved "https://registry.yarnpkg.com/@oclif/tslint/-/tslint-1.0.2.tgz#793d39758082f359469dba8ce5cfba041d7a7847"
51+
"@oclif/tslint@^1.1.0":
52+
version "1.1.0"
53+
resolved "https://registry.yarnpkg.com/@oclif/tslint/-/tslint-1.1.0.tgz#a2d494a61afa882a685fe5f4d866dafd18990728"
5454
dependencies:
55-
tslint-xo "^0.6.0"
55+
tslint-xo "^0.7.0"
5656

5757
"@sinonjs/formatio@^2.0.0":
5858
version "2.0.0"
@@ -98,10 +98,6 @@ ansi-escapes@^3.0.0:
9898
version "3.0.0"
9999
resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.0.0.tgz#ec3e8b4e9f8064fc02c3ac9b65f1c275bda8ef92"
100100

101-
ansi-regex@^0.2.0, ansi-regex@^0.2.1:
102-
version "0.2.1"
103-
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-0.2.1.tgz#0d8e946967a3d8143f93e24e298525fc1b2235f9"
104-
105101
ansi-regex@^2.0.0:
106102
version "2.1.1"
107103
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
@@ -110,10 +106,6 @@ ansi-regex@^3.0.0:
110106
version "3.0.0"
111107
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998"
112108

113-
ansi-styles@^1.1.0:
114-
version "1.1.0"
115-
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-1.1.0.tgz#eaecbf66cd706882760b2f4691582b8f55d7a7de"
116-
117109
ansi-styles@^2.2.1:
118110
version "2.2.1"
119111
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe"
@@ -193,16 +185,6 @@ chai@^4.1.2:
193185
pathval "^1.0.0"
194186
type-detect "^4.0.0"
195187

196-
chalk@0.5.1:
197-
version "0.5.1"
198-
resolved "https://registry.yarnpkg.com/chalk/-/chalk-0.5.1.tgz#663b3a648b68b55d04690d49167aa837858f2174"
199-
dependencies:
200-
ansi-styles "^1.1.0"
201-
escape-string-regexp "^1.0.0"
202-
has-ansi "^0.1.0"
203-
strip-ansi "^0.3.0"
204-
supports-color "^0.2.0"
205-
206188
chalk@^1.1.3:
207189
version "1.1.3"
208190
resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98"
@@ -270,10 +252,6 @@ commander@2.11.0:
270252
version "2.11.0"
271253
resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563"
272254

273-
commander@2.6.0:
274-
version "2.6.0"
275-
resolved "https://registry.yarnpkg.com/commander/-/commander-2.6.0.tgz#9df7e52fb2a0cb0fb89058ee80c3104225f37e1d"
276-
277255
commander@^2.12.1:
278256
version "2.14.1"
279257
resolved "https://registry.yarnpkg.com/commander/-/commander-2.14.1.tgz#2235123e37af8ca3c65df45b026dbd357b01b9aa"
@@ -282,19 +260,6 @@ concat-map@0.0.1:
282260
version "0.0.1"
283261
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
284262

285-
concurrently@^3.5.1:
286-
version "3.5.1"
287-
resolved "https://registry.yarnpkg.com/concurrently/-/concurrently-3.5.1.tgz#ee8b60018bbe86b02df13e5249453c6ececd2521"
288-
dependencies:
289-
chalk "0.5.1"
290-
commander "2.6.0"
291-
date-fns "^1.23.0"
292-
lodash "^4.5.1"
293-
rx "2.3.24"
294-
spawn-command "^0.0.2-1"
295-
supports-color "^3.2.3"
296-
tree-kill "^1.1.0"
297-
298263
content-type@^1.0.4:
299264
version "1.0.4"
300265
resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b"
@@ -323,10 +288,6 @@ d@1:
323288
dependencies:
324289
es5-ext "^0.10.9"
325290

326-
date-fns@^1.23.0:
327-
version "1.29.0"
328-
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.29.0.tgz#12e609cdcb935127311d04d33334e2960a2a54e6"
329-
330291
debug@3.1.0, debug@^3.1.0:
331292
version "3.1.0"
332293
resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261"
@@ -351,7 +312,7 @@ diff@^3.1.0, diff@^3.2.0:
351312
version "3.4.0"
352313
resolved "https://registry.yarnpkg.com/diff/-/diff-3.4.0.tgz#b1d85507daf3964828de54b37d0d73ba67dda56c"
353314

354-
doctrine@^0.7.2:
315+
doctrine@0.7.2:
355316
version "0.7.2"
356317
resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-0.7.2.tgz#7cb860359ba3be90e040b26b729ce4bfa654c523"
357318
dependencies:
@@ -401,7 +362,7 @@ es6-symbol@3.1.1, es6-symbol@^3.1.1, es6-symbol@~3.1.1:
401362
d "1"
402363
es5-ext "~0.10.14"
403364

404-
escape-string-regexp@1.0.5, escape-string-regexp@^1.0.0, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
365+
escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
405366
version "1.0.5"
406367
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
407368

@@ -444,12 +405,12 @@ extract-stack@^1.0.0:
444405
version "1.0.0"
445406
resolved "https://registry.yarnpkg.com/extract-stack/-/extract-stack-1.0.0.tgz#b97acaf9441eea2332529624b732fc5a1c8165fa"
446407

447-
fancy-test@^1.0.1:
448-
version "1.0.1"
449-
resolved "https://registry.yarnpkg.com/fancy-test/-/fancy-test-1.0.1.tgz#28eb801dffc341d7202ed90b6944019922b08b5b"
408+
fancy-test@^1.0.3:
409+
version "1.0.3"
410+
resolved "https://registry.yarnpkg.com/fancy-test/-/fancy-test-1.0.3.tgz#9a1a109973f39eeecb5f35c9df0e1700214cf2a0"
450411
dependencies:
451-
lodash "^4.17.4"
452-
stdout-stderr "^0.1.6"
412+
lodash "^4.17.5"
413+
stdout-stderr "^0.1.7"
453414

454415
fill-keys@^1.0.2:
455416
version "1.0.2"
@@ -497,22 +458,12 @@ growl@1.10.3:
497458
version "1.10.3"
498459
resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.3.tgz#1926ba90cf3edfe2adb4927f5880bc22c66c790f"
499460

500-
has-ansi@^0.1.0:
501-
version "0.1.0"
502-
resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-0.1.0.tgz#84f265aae8c0e6a88a12d7022894b7568894c62e"
503-
dependencies:
504-
ansi-regex "^0.2.0"
505-
506461
has-ansi@^2.0.0:
507462
version "2.0.0"
508463
resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91"
509464
dependencies:
510465
ansi-regex "^2.0.0"
511466

512-
has-flag@^1.0.0:
513-
version "1.0.0"
514-
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa"
515-
516467
has-flag@^2.0.0:
517468
version "2.0.0"
518469
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51"
@@ -623,7 +574,7 @@ lodash@^4.17.2, lodash@^4.17.5:
623574
version "4.17.5"
624575
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.5.tgz#99a92d65c0272debe8c96b6057bc8fbfa3bed511"
625576

626-
lodash@^4.17.4, lodash@^4.5.1:
577+
lodash@^4.17.4:
627578
version "4.17.4"
628579
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"
629580

@@ -689,9 +640,9 @@ ms@2.0.0:
689640
version "2.0.0"
690641
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"
691642

692-
netrc-parser@^3.1.2:
693-
version "3.1.2"
694-
resolved "https://registry.yarnpkg.com/netrc-parser/-/netrc-parser-3.1.2.tgz#4d857feb74500e0348b3cd557c23bd798f1a7776"
643+
netrc-parser@^3.1.3:
644+
version "3.1.3"
645+
resolved "https://registry.yarnpkg.com/netrc-parser/-/netrc-parser-3.1.3.tgz#b4d70487e1a849dc2294c0362a5f21812115891a"
695646
dependencies:
696647
debug "^3.1.0"
697648
execa "^0.10.0"
@@ -812,10 +763,6 @@ resolve@^1.3.2, resolve@^1.5.0, resolve@~1.5.0:
812763
dependencies:
813764
path-parse "^1.0.5"
814765

815-
rx@2.3.24:
816-
version "2.3.24"
817-
resolved "https://registry.yarnpkg.com/rx/-/rx-2.3.24.tgz#14f950a4217d7e35daa71bbcbe58eff68ea4b2b7"
818-
819766
safe-buffer@^5.0.1:
820767
version "5.1.1"
821768
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853"
@@ -864,15 +811,11 @@ source-map@^0.6.0:
864811
version "0.6.1"
865812
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
866813

867-
spawn-command@^0.0.2-1:
868-
version "0.0.2-1"
869-
resolved "https://registry.yarnpkg.com/spawn-command/-/spawn-command-0.0.2-1.tgz#62f5e9466981c1b796dc5929937e11c9c6921bd0"
870-
871814
sprintf-js@~1.0.2:
872815
version "1.0.3"
873816
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
874817

875-
stdout-stderr@^0.1.6:
818+
stdout-stderr@^0.1.7:
876819
version "0.1.7"
877820
resolved "https://registry.yarnpkg.com/stdout-stderr/-/stdout-stderr-0.1.7.tgz#f3f69391f3e721c2c52aa92fbfa18b8a6e9ce3df"
878821
dependencies:
@@ -892,12 +835,6 @@ stringify-object-es5@^2.5.0:
892835
is-plain-obj "^1.0.0"
893836
is-regexp "^1.0.0"
894837

895-
strip-ansi@^0.3.0:
896-
version "0.3.0"
897-
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-0.3.0.tgz#25f48ea22ca79187f3174a4db8759347bb126220"
898-
dependencies:
899-
ansi-regex "^0.2.1"
900-
901838
strip-ansi@^3.0.0:
902839
version "3.0.1"
903840
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf"
@@ -920,20 +857,10 @@ supports-color@4.4.0:
920857
dependencies:
921858
has-flag "^2.0.0"
922859

923-
supports-color@^0.2.0:
924-
version "0.2.0"
925-
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-0.2.0.tgz#d92de2694eb3f67323973d7ae3d8b55b4c22190a"
926-
927860
supports-color@^2.0.0:
928861
version "2.0.0"
929862
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
930863

931-
supports-color@^3.2.3:
932-
version "3.2.3"
933-
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.2.3.tgz#65ac0504b3954171d8a64946b2ae3cbb8a5f54f6"
934-
dependencies:
935-
has-flag "^1.0.0"
936-
937864
supports-color@^5.1.0, supports-color@^5.2.0:
938865
version "5.2.0"
939866
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.2.0.tgz#b0d5333b1184dd3666cbe5aa0b45c5ac7ac17a4a"
@@ -959,10 +886,6 @@ text-encoding@^0.6.4:
959886
version "0.6.4"
960887
resolved "https://registry.yarnpkg.com/text-encoding/-/text-encoding-0.6.4.tgz#e399a982257a276dae428bb92845cb71bdc26d19"
961888

962-
tree-kill@^1.1.0:
963-
version "1.2.0"
964-
resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.0.tgz#5846786237b4239014f05db156b643212d4c6f36"
965-
966889
ts-node@^5.0.1:
967890
version "5.0.1"
968891
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-5.0.1.tgz#78e5d1cb3f704de1b641e43b76be2d4094f06f81"
@@ -976,7 +899,7 @@ ts-node@^5.0.1:
976899
source-map-support "^0.5.3"
977900
yn "^2.0.0"
978901

979-
tslib@^1.0.0, tslib@^1.7.1, tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0:
902+
tslib@1.9.0, tslib@^1.7.1, tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0:
980903
version "1.9.0"
981904
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8"
982905

@@ -991,26 +914,26 @@ tslint-consistent-codestyle@^1.11.0:
991914
tslib "^1.7.1"
992915
tsutils "^2.21.0"
993916

994-
tslint-eslint-rules@^4.1.1:
995-
version "4.1.1"
996-
resolved "https://registry.yarnpkg.com/tslint-eslint-rules/-/tslint-eslint-rules-4.1.1.tgz#7c30e7882f26bc276bff91d2384975c69daf88ba"
917+
tslint-eslint-rules@^5.1.0:
918+
version "5.1.0"
919+
resolved "https://registry.yarnpkg.com/tslint-eslint-rules/-/tslint-eslint-rules-5.1.0.tgz#3232b318da55dbb5a83e3f5d657c1ddbb27b9ff2"
997920
dependencies:
998-
doctrine "^0.7.2"
999-
tslib "^1.0.0"
1000-
tsutils "^1.4.0"
921+
doctrine "0.7.2"
922+
tslib "1.9.0"
923+
tsutils "2.8.0"
1001924

1002925
tslint-microsoft-contrib@^5.0.2:
1003926
version "5.0.2"
1004927
resolved "https://registry.yarnpkg.com/tslint-microsoft-contrib/-/tslint-microsoft-contrib-5.0.2.tgz#ecc2a797f777a12f0066944cec0c81a9e7c59ee9"
1005928
dependencies:
1006929
tsutils "^2.12.1"
1007930

1008-
tslint-xo@^0.6.0:
1009-
version "0.6.0"
1010-
resolved "https://registry.yarnpkg.com/tslint-xo/-/tslint-xo-0.6.0.tgz#95a05b8dcac7aaa1f4d6ca1397a3c4c45a8b848e"
931+
tslint-xo@^0.7.0:
932+
version "0.7.0"
933+
resolved "https://registry.yarnpkg.com/tslint-xo/-/tslint-xo-0.7.0.tgz#be5a1d67f8ade5d92aa8c0a21d9cfdcbaf06f3e0"
1011934
dependencies:
1012935
tslint-consistent-codestyle "^1.11.0"
1013-
tslint-eslint-rules "^4.1.1"
936+
tslint-eslint-rules "^5.1.0"
1014937
tslint-microsoft-contrib "^5.0.2"
1015938

1016939
tslint@^5.8.0, tslint@^5.9.1:
@@ -1030,9 +953,11 @@ tslint@^5.8.0, tslint@^5.9.1:
1030953
tslib "^1.8.0"
1031954
tsutils "^2.12.1"
1032955

1033-
tsutils@^1.4.0:
1034-
version "1.9.1"
1035-
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-1.9.1.tgz#b9f9ab44e55af9681831d5f28d0aeeaf5c750cb0"
956+
tsutils@2.8.0:
957+
version "2.8.0"
958+
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-2.8.0.tgz#0160173729b3bf138628dd14a1537e00851d814a"
959+
dependencies:
960+
tslib "^1.7.1"
1036961

1037962
tsutils@^2.12.1, tsutils@^2.21.0:
1038963
version "2.21.1"

0 commit comments

Comments
 (0)