File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ const fs = require('fs');
3
3
const path = require ( 'path' ) ;
4
4
const rp = require ( 'request-promise' ) ;
5
5
const _ = require ( 'lodash' ) ;
6
+ const CFError = require ( 'cf-errors' ) ;
6
7
const { printError } = require ( '../../interface/cli/helpers/general' ) ;
7
8
8
9
const { version } = JSON . parse ( fs . readFileSync ( path . resolve ( __dirname , '../../../package.json' ) ) ) ;
@@ -33,11 +34,17 @@ const sendHttpRequest = async (httpOptions, authContext) => {
33
34
response = await rp ( finalOptions ) ;
34
35
} catch ( err ) {
35
36
if ( _ . isEqual ( err . statusCode , 401 ) ) {
36
- printError ( 'Error: Please create or update your authentication context' ) ;
37
+ printError ( new CFError ( {
38
+ cause : err ,
39
+ message : 'Error: Please create or update your authentication context'
40
+ } ) ) ;
37
41
process . exit ( 1 ) ;
38
42
}
39
43
if ( _ . isEqual ( err . statusCode , 403 ) ) {
40
- printError ( 'Error: You do not have permissions to perform this action' ) ;
44
+ printError ( new CFError ( {
45
+ cause : err ,
46
+ message : 'Error: You do not have permissions to perform this action'
47
+ } ) ) ;
41
48
process . exit ( 1 ) ;
42
49
}
43
50
You can’t perform that action at this time.
0 commit comments