title: Android: How handle message error from the server using Volley?
body: <p>I am using <strong>Volley</strong> for my Android app to fetch data from my server. It works well except when handling the error from my server. My server sends this response when there is a mistake:</p>
  
  <pre><code>{
      "status": 400,
      "message": "Errors (2): A name is required- Julien is already used. Not creating."
  }
  </code></pre>
  
  <p>My goal is to get the message and then display it in a <code>Toast</code>. I followed some sample for how to do this, but it doesn't work.</p>
  
  <p><strong>There is my error listener :</strong></p>
  
  <pre><code>public void onErrorResponse(VolleyError error) {
              int  statusCode = error.networkResponse.statusCode;
              NetworkResponse response = error.networkResponse;
  
              Log.d("testerror",""+statusCode+" "+response.data);
              // Handle your error types accordingly.For Timeout &amp; No connection error, you can show 'retry' button.
              // For AuthFailure, you can re login with user credentials.
              // For ClientError, 400 &amp; 401, Errors happening on client side when sending api request.
              // In this case you can check how client is forming the api and debug accordingly.
              // For ServerError 5xx, you can do retry or handle accordingly.
              if( error instanceof NetworkError) {
              } else if( error instanceof ClientError) {
              } else if( error instanceof ServerError) {
              } else if( error instanceof AuthFailureError) {
              } else if( error instanceof ParseError) {
              } else if( error instanceof NoConnectionError) {
              } else if( error instanceof TimeoutError) {
              }
              showProgress(false);
              mPasswordView.setError(getString(R.string.error_incorrect_password));
              mPasswordView.requestFocus();
  
          }
  </code></pre>
  
  <p><strong>And there the result of my debugger :</strong> testerror﹕ 400 [B@430b8d60   </p>
  
  <p><strong>EDIT:</strong> Moreover my error.getMessage() is null.</p>
  
  <p>So I don't understand why my variable response.data is not the response from my server.</p>
  
  <p>If someone know how I can get the message from my server it's will be cool.</p>
  
  <p>Thx,</p>