@@ -259,7 +259,7 @@ export class GitExtension implements IGitExtension {
259
259
const response = await httpGitRequest ( '/git/add_all_unstaged' , 'POST' , {
260
260
top_repo_path : path
261
261
} ) ;
262
- if ( response . status !== 200 ) {
262
+ if ( ! response . ok ) {
263
263
const data = await response . json ( ) ;
264
264
throw new ServerConnection . ResponseError ( response , data . message ) ;
265
265
}
@@ -294,7 +294,7 @@ export class GitExtension implements IGitExtension {
294
294
const response = await httpGitRequest ( '/git/add_all_untracked' , 'POST' , {
295
295
top_repo_path : path
296
296
} ) ;
297
- if ( response . status !== 200 ) {
297
+ if ( ! response . ok ) {
298
298
const data = await response . json ( ) ;
299
299
throw new ServerConnection . ResponseError ( response , data . message ) ;
300
300
}
@@ -355,9 +355,9 @@ export class GitExtension implements IGitExtension {
355
355
url,
356
356
name
357
357
} ) ;
358
- if ( response . status !== 200 ) {
359
- const data = await response . text ( ) ;
360
- throw new ServerConnection . ResponseError ( response , data ) ;
358
+ if ( ! response . ok ) {
359
+ const data = await response . json ( ) ;
360
+ throw new ServerConnection . ResponseError ( response , data . message ) ;
361
361
}
362
362
} catch ( err ) {
363
363
throw new ServerConnection . NetworkError ( err ) ;
@@ -387,9 +387,9 @@ export class GitExtension implements IGitExtension {
387
387
current_path : path ,
388
388
history_count : historyCount
389
389
} ) ;
390
- if ( response . status !== 200 ) {
391
- const data = await response . text ( ) ;
392
- throw new ServerConnection . ResponseError ( response , data ) ;
390
+ if ( ! response . ok ) {
391
+ const data = await response . json ( ) ;
392
+ throw new ServerConnection . ResponseError ( response , data . message ) ;
393
393
}
394
394
return response . json ( ) ;
395
395
} catch ( err ) {
@@ -446,7 +446,7 @@ export class GitExtension implements IGitExtension {
446
446
447
447
try {
448
448
const response = await httpGitRequest ( '/git/checkout' , 'POST' , body ) ;
449
- if ( response . status !== 200 ) {
449
+ if ( ! response . ok ) {
450
450
return response . json ( ) . then ( ( data : any ) => {
451
451
throw new ServerConnection . ResponseError ( response , data . message ) ;
452
452
} ) ;
@@ -484,7 +484,7 @@ export class GitExtension implements IGitExtension {
484
484
} ;
485
485
486
486
const response = await httpGitRequest ( '/git/clone' , 'POST' , obj ) ;
487
- if ( response . status !== 200 ) {
487
+ if ( ! response . ok ) {
488
488
const data = await response . json ( ) ;
489
489
throw new ServerConnection . ResponseError ( response , data . message ) ;
490
490
}
@@ -519,7 +519,7 @@ export class GitExtension implements IGitExtension {
519
519
commit_msg : message ,
520
520
top_repo_path : path
521
521
} ) ;
522
- if ( response . status !== 200 ) {
522
+ if ( ! response . ok ) {
523
523
return response . json ( ) . then ( ( data : any ) => {
524
524
throw new ServerConnection . ResponseError ( response , data . message ) ;
525
525
} ) ;
@@ -597,7 +597,7 @@ export class GitExtension implements IGitExtension {
597
597
commit_id : commitId ,
598
598
top_repo_path : path
599
599
} ) ;
600
- if ( response . status !== 200 ) {
600
+ if ( ! response . ok ) {
601
601
return response . json ( ) . then ( ( data : any ) => {
602
602
throw new ServerConnection . ResponseError ( response , data . message ) ;
603
603
} ) ;
@@ -631,7 +631,7 @@ export class GitExtension implements IGitExtension {
631
631
selected_hash : hash ,
632
632
current_path : path
633
633
} ) ;
634
- if ( response . status !== 200 ) {
634
+ if ( ! response . ok ) {
635
635
const data = await response . json ( ) ;
636
636
throw new ServerConnection . ResponseError ( response , data . message ) ;
637
637
}
@@ -682,7 +682,7 @@ export class GitExtension implements IGitExtension {
682
682
const response = await httpGitRequest ( '/git/init' , 'POST' , {
683
683
current_path : path
684
684
} ) ;
685
- if ( response . status !== 200 ) {
685
+ if ( ! response . ok ) {
686
686
return response . json ( ) . then ( ( data : any ) => {
687
687
throw new ServerConnection . ResponseError ( response , data . message ) ;
688
688
} ) ;
@@ -714,7 +714,7 @@ export class GitExtension implements IGitExtension {
714
714
current_path : path ,
715
715
history_count : historyCount
716
716
} ) ;
717
- if ( response . status !== 200 ) {
717
+ if ( ! response . ok ) {
718
718
const data = await response . json ( ) ;
719
719
throw new ServerConnection . ResponseError ( response , data . message ) ;
720
720
}
@@ -758,7 +758,7 @@ export class GitExtension implements IGitExtension {
758
758
} ;
759
759
760
760
const response = await httpGitRequest ( '/git/pull' , 'POST' , obj ) ;
761
- if ( response . status !== 200 ) {
761
+ if ( ! response . ok ) {
762
762
const data = await response . json ( ) ;
763
763
throw new ServerConnection . ResponseError ( response , data . message ) ;
764
764
}
@@ -790,7 +790,7 @@ export class GitExtension implements IGitExtension {
790
790
} ;
791
791
792
792
const response = await httpGitRequest ( '/git/push' , 'POST' , obj ) ;
793
- if ( response . status !== 200 ) {
793
+ if ( ! response . ok ) {
794
794
const data = await response . json ( ) ;
795
795
throw new ServerConnection . ResponseError ( response , data . message ) ;
796
796
}
@@ -846,7 +846,7 @@ export class GitExtension implements IGitExtension {
846
846
current_path : path
847
847
} ) ;
848
848
const data = await response . json ( ) ;
849
- if ( response . status !== 200 ) {
849
+ if ( ! response . ok ) {
850
850
console . error ( data . message ) ;
851
851
// TODO should we notify the user
852
852
this . _setStatus ( [ ] ) ;
@@ -892,7 +892,7 @@ export class GitExtension implements IGitExtension {
892
892
filename : filename === undefined ? null : filename ,
893
893
top_repo_path : path
894
894
} ) ;
895
- if ( response . status !== 200 ) {
895
+ if ( ! response . ok ) {
896
896
return response . json ( ) . then ( ( data : any ) => {
897
897
throw new ServerConnection . ResponseError ( response , data . message ) ;
898
898
} ) ;
@@ -932,7 +932,7 @@ export class GitExtension implements IGitExtension {
932
932
commit_id : commitId ,
933
933
top_repo_path : path
934
934
} ) ;
935
- if ( response . status !== 200 ) {
935
+ if ( ! response . ok ) {
936
936
return response . json ( ) . then ( ( data : any ) => {
937
937
throw new ServerConnection . ResponseError ( response , data . message ) ;
938
938
} ) ;
@@ -953,7 +953,7 @@ export class GitExtension implements IGitExtension {
953
953
const response = await httpGitRequest ( '/git/show_prefix' , 'POST' , {
954
954
current_path : path
955
955
} ) ;
956
- if ( response . status !== 200 ) {
956
+ if ( ! response . ok ) {
957
957
const data = await response . json ( ) ;
958
958
throw new ServerConnection . ResponseError ( response , data . message ) ;
959
959
}
@@ -969,7 +969,7 @@ export class GitExtension implements IGitExtension {
969
969
const response = await httpGitRequest ( '/git/show_top_level' , 'POST' , {
970
970
current_path : path
971
971
} ) ;
972
- if ( response . status !== 200 ) {
972
+ if ( ! response . ok ) {
973
973
const data = await response . json ( ) ;
974
974
throw new ServerConnection . ResponseError ( response , data . message ) ;
975
975
}
@@ -999,7 +999,7 @@ export class GitExtension implements IGitExtension {
999
999
const response = await httpGitRequest ( '/git/branch' , 'POST' , {
1000
1000
current_path : path
1001
1001
} ) ;
1002
- if ( response . status !== 200 ) {
1002
+ if ( ! response . ok ) {
1003
1003
const data = await response . json ( ) ;
1004
1004
throw new ServerConnection . ResponseError ( response , data . message ) ;
1005
1005
}
0 commit comments