private void extractErrors ( JsonObject object ) { JsonObject response ; try { response = object . getAsJsonObject ( "response" ) ; } catch ( ClassCastException ex ) { return ; // response is non-object } if ( response == null ) { return ; } JsonArray e = response . getAsJsonArray ( "errors" ) ; if ( e == null ) { return ; } // Set the errors errors = new ArrayList < String > ( e . size ( ) ) ; for ( int i = 0 ; i < e . size ( ) ; i ++ ) { errors . add ( e . get ( i ) . getAsString ( ) ) ; } }
Pull the errors out of the response if present