Java Exception wrapping

So I wrote some code that calls to my web service and returns data formatted as JSON. my Json deserializer throws an exception if the format of the data is unknown. There's also another call being made to the response object from the rest client library I am using. My question is, is this the appropriate way to catch each exception; as in the appropriate way to do exception wrapping in a sense where both exceptions are equal. Or is it fine the way that it's being done?

                 try {

                        TokenError error= null;
                        try {
                            error = new Gson().fromJson(response.errorBody().string(),TokenError.class);
                        } catch (IOException e) {
                            e.printStackTrace();
                        }

                        Toast.makeText(LoginActivity.this,error.getErrorDescription(),Toast.LENGTH_SHORT).show();;
                    } catch (JsonSyntaxException e) {
                        e.printStackTrace();
                        Toast.makeText(LoginActivity.this,"Server error. Contact administrator.",Toast.LENGTH_SHORT).show();;

                    }
                
              
jdean2k6
Language:

1 Suggestion

1

erip
Language: