So, I wanted to work on the error handling part, currently it is quite messy (both on my part and yours).
public void onError(ANError error) {
// handle error
progressDialog.dismiss();
AlertDialog.Builder builder = new AlertDialog.Builder(SignUpActivity.this);
builder.setTitle("Failed")
.setMessage("Something went wrong, please try again!")
.setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Here is what currently the case in the backend, we have two types of error responses:
EBS errors {"details": object, "message": string} // i omitted other parts
validation errors the same as EBS errors
other errors, which is usually about authentication, etc (umm non-payment errors)
{"code": "some_error", "message": "a description of this error, usually a human friendly format"}
My proposal is like this:
a method somewhere that converts the error.getErrorBody() to a class that has code and message fields (and they are both of type string)
I will refine this one later-- it is now code and message, but it should be rather errorCode and errorMessage, and also bear in mind that, this is different from http status code.
So, I wanted to work on the error handling part, currently it is quite messy (both on my part and yours).
Here is what currently the case in the backend, we have two types of error responses:
My proposal is like this:
a method somewhere that converts the error.getErrorBody() to a class that has
code
andmessage
fields (and they are both of type string)