@@ -144,19 +144,19 @@ fn get_own_mods(validated: bool, config: &mut Config) -> Vec<SimpleDevMod> {
144144 . send ( )
145145 . nice_unwrap ( "Unable to connect to Geode Index" ) ;
146146
147- if response. status ( ) != 200 {
148- let body: ApiResponse < String > = response
149- . json ( )
150- . nice_unwrap ( "Unable to parse response from Geode Index" ) ;
151- fatal ! ( "Unable to fetch mods: {}" , body. error) ;
152- }
153-
154147 if response. status ( ) == 401 {
155148 config. index_token = None ;
156149 config. save ( ) ;
157150 fatal ! ( "Invalid token. Please login again." ) ;
158151 }
159152
153+ if !response. status ( ) . is_success ( ) {
154+ let body: ApiResponse < String > = response
155+ . json ( )
156+ . nice_unwrap ( "Unable to parse response from Geode Index" ) ;
157+ fatal ! ( "Unable to fetch mods: {}" , body. error) ;
158+ }
159+
160160 let mods = response
161161 . json :: < ApiResponse < Vec < SimpleDevMod > > > ( )
162162 . nice_unwrap ( "Unable to parse response from Geode Index" ) ;
@@ -248,7 +248,7 @@ fn add_developer(mod_to_edit: &SimpleDevMod, config: &mut Config) {
248248 . send ( )
249249 . nice_unwrap ( "Unable to connect to Geode Index" ) ;
250250
251- if response. status ( ) != 204 {
251+ if ! response. status ( ) . is_success ( ) {
252252 let body: ApiResponse < String > = response
253253 . json ( )
254254 . nice_unwrap ( "Unable to parse response from Geode Index" ) ;
@@ -274,7 +274,7 @@ fn remove_developer(mod_to_edit: &SimpleDevMod, config: &mut Config) {
274274 . send ( )
275275 . nice_unwrap ( "Unable to connect to Geode Index" ) ;
276276
277- if response. status ( ) != 204 {
277+ if ! response. status ( ) . is_success ( ) {
278278 let body: ApiResponse < String > = response
279279 . json ( )
280280 . nice_unwrap ( "Unable to parse response from Geode Index" ) ;
@@ -300,7 +300,7 @@ pub fn get_user_profile(config: &mut Config) -> DeveloperProfile {
300300 . send ( )
301301 . nice_unwrap ( "Unable to connect to Geode Index" ) ;
302302
303- if response. status ( ) != 200 {
303+ if ! response. status ( ) . is_success ( ) {
304304 let body: ApiResponse < String > = response
305305 . json ( )
306306 . nice_unwrap ( "Unable to parse response from Geode Index" ) ;
@@ -358,7 +358,7 @@ pub fn edit_profile(config: &mut Config) {
358358 . send ( )
359359 . nice_unwrap ( "Unable to connect to Geode Index" ) ;
360360
361- if response. status ( ) != 204 {
361+ if ! response. status ( ) . is_success ( ) {
362362 let body: ApiResponse < String > = response
363363 . json ( )
364364 . nice_unwrap ( "Unable to parse response from Geode Index" ) ;
0 commit comments