title: How to get error message description using Volley
body: <p>I'm sending an http request from Android Java using the Volley library to a c# backend. The backend application responds with a error code and description as intended, as well as a StatusDescription. I can see the response status description through wireshark but do not know how to get the description string on the android side. </p>
  
  <pre><code>    final JsonObjectRequest request = new JsonObjectRequest(JsonObjectRequest.Method.POST,
                                  url,json,
                              new Response.Listener&lt;JSONObject&gt;() {
  
                                  @Override
                                  public void onResponse(JSONObject response) {
                                      TextView mTextView = (TextView) findViewById(R.id.output);
                                      print("Success");
                                  }
                              }, new Response.ErrorListener() {
  
                                  @Override
                                  public void onErrorResponse(VolleyError error) {
                                      TextView mTextView = (TextView) findViewById(R.id.output);
                                      print("Failure (" + error.networkResponse.statusCode + ")");
  //Trying to get the error description/response phrase here
                              }
                          }
                      );
  </code></pre>
  
  <p>This is the C# code processing the request:</p>
  
  <p>[WebInvoke(Method = "POST", UriTemplate = "users", BodyStyle = WebMessageBodyStyle.Wrapped, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
          [OperationContract]
          void addUser(String username, String firstname, String lastname, String email, String hash)
          {
              Console.WriteLine(DateTime.Now + " Packet receieved");</p>
  
  <pre><code>        //Stores the response object that will be sent back to the android client
          OutgoingWebResponseContext response = WebOperationContext.Current.OutgoingResponse;
          String description = "User added";
          response.StatusCode = System.Net.HttpStatusCode.OK;
  
          //Tries to add the new user
          try
          {
              userTable.Insert(username,firstname,lastname,email,hash);
          }
          catch (SqlException e)
          {
              //Default response is a conflict
              response.StatusCode = System.Net.HttpStatusCode.Conflict;
  
              description = "Bad Request (" + e.Message + ")";
  
              //Check what the conflict is
              if (userTable.GetData().AsEnumerable().Any(row =&gt; username == row.Field&lt;String&gt;("username")))
              {
                  description = "Username in use";
              }
              else if (userTable.GetData().AsEnumerable().Any(row =&gt; email == row.Field&lt;String&gt;("email")))
              {
                  description = "Email address in use";
              }
              else
              {
                  response.StatusCode = System.Net.HttpStatusCode.BadRequest;
              }
          }
  
          //display and respond with the description
          Console.WriteLine(description);
          response.StatusDescription = description;
      }
  </code></pre>
  
  <p>I've looked through other peoples questions but can't seem to find the answer I'm looking for. Anyone know how to do this? Many methods I have tried resulted in empty curly braces, indicating JSON with an empty body. I am trying specifically to get the status description.</p>