This repository was archived by the owner on Dec 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +30
-12
lines changed Expand file tree Collapse file tree 2 files changed +30
-12
lines changed Original file line number Diff line number Diff line change @@ -66,12 +66,13 @@ if (fileContents && host) {
66
66
} ) ;
67
67
} ) ;
68
68
69
- req . on ( 'error' , function ( e ) {
69
+ req . on ( 'error' , function ( error ) {
70
70
process . stdout . write ( "Error" ) ;
71
71
process . stdout . write ( endOfLine ) ;
72
72
73
- if ( e ) {
74
- process . stdout . write ( e . toString ( ) ) ;
73
+ if ( error ) {
74
+ process . stdout . write ( error . toString ( ) ) ;
75
+ process . stdout . write ( endOfLine ) ;
75
76
}
76
77
77
78
process . exit ( - 1 ) ;
Original file line number Diff line number Diff line change 1
1
var commander = require ( "commander" ) ;
2
2
var package = require ( '../../package.json' )
3
+ var endOfLine = require ( 'os' ) . EOL ;
3
4
var ApiWrapper = require ( '../api' )
4
5
5
6
commander
6
7
. version ( package . version )
7
8
. parse ( process . argv ) ;
8
9
9
- var apiWrapper = new ApiWrapper ( ) ;
10
+ try {
11
+ var apiWrapper = new ApiWrapper ( ) ;
12
+
13
+ apiWrapper . verifyUser ( function ( error , result ) {
14
+ if ( error ) {
15
+ process . stdout . write ( "Error" ) ;
16
+ process . stdout . write ( error ) ;
17
+ process . exit ( ) ;
18
+ }
19
+ else {
20
+ process . stdout . write ( "Success" ) ;
21
+ process . stdout . write ( endOfLine ) ;
22
+ process . stdout . write ( result ) ;
23
+ process . exit ( ) ;
24
+ }
25
+ } ) ;
26
+ }
27
+ catch ( error ) {
28
+ process . stdout . write ( "Error" ) ;
29
+ process . stdout . write ( endOfLine ) ;
10
30
11
- apiWrapper . verifyUser ( function ( error , result ) {
12
31
if ( error ) {
13
- process . stdout . write ( error ) ;
14
- process . exit ( - 1 ) ;
15
- }
16
- else {
17
- process . stdout . write ( result ) ;
18
- process . exit ( ) ;
32
+ process . stdout . write ( error . toString ( ) ) ;
33
+ process . stdout . write ( endOfLine ) ;
19
34
}
20
- } ) ;
35
+
36
+ process . exit ( ) ;
37
+ }
You can’t perform that action at this time.
0 commit comments