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');
33const path = require ( 'path' ) ;
44const rp = require ( 'request-promise' ) ;
55const _ = require ( 'lodash' ) ;
6+ const CFError = require ( 'cf-errors' ) ;
67const { printError } = require ( '../../interface/cli/helpers/general' ) ;
78
89const { version } = JSON . parse ( fs . readFileSync ( path . resolve ( __dirname , '../../../package.json' ) ) ) ;
@@ -33,11 +34,17 @@ const sendHttpRequest = async (httpOptions, authContext) => {
3334 response = await rp ( finalOptions ) ;
3435 } catch ( err ) {
3536 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+ } ) ) ;
3741 process . exit ( 1 ) ;
3842 }
3943 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+ } ) ) ;
4148 process . exit ( 1 ) ;
4249 }
4350
You can’t perform that action at this time.
0 commit comments