@@ -262,7 +262,7 @@ export class GitExtension implements IGitExtension {
262
262
const response = await httpGitRequest ( '/git/add_all_unstaged' , 'POST' , {
263
263
top_repo_path : path
264
264
} ) ;
265
- if ( response . status !== 200 ) {
265
+ if ( ! response . ok ) {
266
266
const data = await response . json ( ) ;
267
267
throw new ServerConnection . ResponseError ( response , data . message ) ;
268
268
}
@@ -297,7 +297,7 @@ export class GitExtension implements IGitExtension {
297
297
const response = await httpGitRequest ( '/git/add_all_untracked' , 'POST' , {
298
298
top_repo_path : path
299
299
} ) ;
300
- if ( response . status !== 200 ) {
300
+ if ( ! response . ok ) {
301
301
const data = await response . json ( ) ;
302
302
throw new ServerConnection . ResponseError ( response , data . message ) ;
303
303
}
@@ -358,9 +358,9 @@ export class GitExtension implements IGitExtension {
358
358
url,
359
359
name
360
360
} ) ;
361
- if ( response . status !== 200 ) {
362
- const data = await response . text ( ) ;
363
- throw new ServerConnection . ResponseError ( response , data ) ;
361
+ if ( ! response . ok ) {
362
+ const data = await response . json ( ) ;
363
+ throw new ServerConnection . ResponseError ( response , data . message ) ;
364
364
}
365
365
} catch ( err ) {
366
366
throw new ServerConnection . NetworkError ( err ) ;
@@ -390,9 +390,9 @@ export class GitExtension implements IGitExtension {
390
390
current_path : path ,
391
391
history_count : historyCount
392
392
} ) ;
393
- if ( response . status !== 200 ) {
394
- const data = await response . text ( ) ;
395
- throw new ServerConnection . ResponseError ( response , data ) ;
393
+ if ( ! response . ok ) {
394
+ const data = await response . json ( ) ;
395
+ throw new ServerConnection . ResponseError ( response , data . message ) ;
396
396
}
397
397
return response . json ( ) ;
398
398
} catch ( err ) {
@@ -449,7 +449,7 @@ export class GitExtension implements IGitExtension {
449
449
450
450
try {
451
451
const response = await httpGitRequest ( '/git/checkout' , 'POST' , body ) ;
452
- if ( response . status !== 200 ) {
452
+ if ( ! response . ok ) {
453
453
return response . json ( ) . then ( ( data : any ) => {
454
454
throw new ServerConnection . ResponseError ( response , data . message ) ;
455
455
} ) ;
@@ -487,7 +487,7 @@ export class GitExtension implements IGitExtension {
487
487
} ;
488
488
489
489
const response = await httpGitRequest ( '/git/clone' , 'POST' , obj ) ;
490
- if ( response . status !== 200 ) {
490
+ if ( ! response . ok ) {
491
491
const data = await response . json ( ) ;
492
492
throw new ServerConnection . ResponseError ( response , data . message ) ;
493
493
}
@@ -522,7 +522,7 @@ export class GitExtension implements IGitExtension {
522
522
commit_msg : message ,
523
523
top_repo_path : path
524
524
} ) ;
525
- if ( response . status !== 200 ) {
525
+ if ( ! response . ok ) {
526
526
return response . json ( ) . then ( ( data : any ) => {
527
527
throw new ServerConnection . ResponseError ( response , data . message ) ;
528
528
} ) ;
@@ -600,7 +600,7 @@ export class GitExtension implements IGitExtension {
600
600
commit_id : commitId ,
601
601
top_repo_path : path
602
602
} ) ;
603
- if ( response . status !== 200 ) {
603
+ if ( ! response . ok ) {
604
604
return response . json ( ) . then ( ( data : any ) => {
605
605
throw new ServerConnection . ResponseError ( response , data . message ) ;
606
606
} ) ;
@@ -634,7 +634,7 @@ export class GitExtension implements IGitExtension {
634
634
selected_hash : hash ,
635
635
current_path : path
636
636
} ) ;
637
- if ( response . status !== 200 ) {
637
+ if ( ! response . ok ) {
638
638
const data = await response . json ( ) ;
639
639
throw new ServerConnection . ResponseError ( response , data . message ) ;
640
640
}
@@ -685,7 +685,7 @@ export class GitExtension implements IGitExtension {
685
685
const response = await httpGitRequest ( '/git/init' , 'POST' , {
686
686
current_path : path
687
687
} ) ;
688
- if ( response . status !== 200 ) {
688
+ if ( ! response . ok ) {
689
689
return response . json ( ) . then ( ( data : any ) => {
690
690
throw new ServerConnection . ResponseError ( response , data . message ) ;
691
691
} ) ;
@@ -717,7 +717,7 @@ export class GitExtension implements IGitExtension {
717
717
current_path : path ,
718
718
history_count : historyCount
719
719
} ) ;
720
- if ( response . status !== 200 ) {
720
+ if ( ! response . ok ) {
721
721
const data = await response . json ( ) ;
722
722
throw new ServerConnection . ResponseError ( response , data . message ) ;
723
723
}
@@ -761,7 +761,7 @@ export class GitExtension implements IGitExtension {
761
761
} ;
762
762
763
763
const response = await httpGitRequest ( '/git/pull' , 'POST' , obj ) ;
764
- if ( response . status !== 200 ) {
764
+ if ( ! response . ok ) {
765
765
const data = await response . json ( ) ;
766
766
throw new ServerConnection . ResponseError ( response , data . message ) ;
767
767
}
@@ -793,7 +793,7 @@ export class GitExtension implements IGitExtension {
793
793
} ;
794
794
795
795
const response = await httpGitRequest ( '/git/push' , 'POST' , obj ) ;
796
- if ( response . status !== 200 ) {
796
+ if ( ! response . ok ) {
797
797
const data = await response . json ( ) ;
798
798
throw new ServerConnection . ResponseError ( response , data . message ) ;
799
799
}
@@ -849,7 +849,7 @@ export class GitExtension implements IGitExtension {
849
849
current_path : path
850
850
} ) ;
851
851
const data = await response . json ( ) ;
852
- if ( response . status !== 200 ) {
852
+ if ( ! response . ok ) {
853
853
console . error ( data . message ) ;
854
854
// TODO should we notify the user
855
855
this . _setStatus ( [ ] ) ;
@@ -895,7 +895,7 @@ export class GitExtension implements IGitExtension {
895
895
filename : filename === undefined ? null : filename ,
896
896
top_repo_path : path
897
897
} ) ;
898
- if ( response . status !== 200 ) {
898
+ if ( ! response . ok ) {
899
899
return response . json ( ) . then ( ( data : any ) => {
900
900
throw new ServerConnection . ResponseError ( response , data . message ) ;
901
901
} ) ;
@@ -935,7 +935,7 @@ export class GitExtension implements IGitExtension {
935
935
commit_id : commitId ,
936
936
top_repo_path : path
937
937
} ) ;
938
- if ( response . status !== 200 ) {
938
+ if ( ! response . ok ) {
939
939
return response . json ( ) . then ( ( data : any ) => {
940
940
throw new ServerConnection . ResponseError ( response , data . message ) ;
941
941
} ) ;
@@ -956,7 +956,7 @@ export class GitExtension implements IGitExtension {
956
956
const response = await httpGitRequest ( '/git/show_prefix' , 'POST' , {
957
957
current_path : path
958
958
} ) ;
959
- if ( response . status !== 200 ) {
959
+ if ( ! response . ok ) {
960
960
const data = await response . json ( ) ;
961
961
throw new ServerConnection . ResponseError ( response , data . message ) ;
962
962
}
@@ -972,7 +972,7 @@ export class GitExtension implements IGitExtension {
972
972
const response = await httpGitRequest ( '/git/show_top_level' , 'POST' , {
973
973
current_path : path
974
974
} ) ;
975
- if ( response . status !== 200 ) {
975
+ if ( ! response . ok ) {
976
976
const data = await response . json ( ) ;
977
977
throw new ServerConnection . ResponseError ( response , data . message ) ;
978
978
}
@@ -1002,7 +1002,7 @@ export class GitExtension implements IGitExtension {
1002
1002
const response = await httpGitRequest ( '/git/branch' , 'POST' , {
1003
1003
current_path : path
1004
1004
} ) ;
1005
- if ( response . status !== 200 ) {
1005
+ if ( ! response . ok ) {
1006
1006
const data = await response . json ( ) ;
1007
1007
throw new ServerConnection . ResponseError ( response , data . message ) ;
1008
1008
}
0 commit comments