alaurenz / metrobike

0 stars 1 forks source link

Double Error Messages #82

Closed CoolCapri closed 11 years ago

CoolCapri commented 11 years ago

When I deliberately disable internet connection and try to request for routes, the backend does reports the lost connection. However, it show me "Having trouble connecting to the server. Please try again later(no period)" for 2 times instead of 1. Does it accidentally append this error message for 2 times?

dutchscout commented 11 years ago

This currently happens for all errors.

What is going on is that the DirectionsRequest object is printing out the meaning of the return code it got from the algorithm and also the error log the algorithm kept in case there was more than one error. Perhaps we could split these into getBasicErrorMessage and getExtendedErrorMessage (?)

CoolCapri commented 11 years ago

I agree. So the format to be displayed will be errorMessage = "Error getting directions: " + dReq.getBasicErrorMessages() + getExtendedErrorMessages(); ?

dutchscout commented 11 years ago

OK. getExtendedErrorMessages() has been implemented to store only the messages specifically logged by the last-running algorithm. Try it out and let me know what you think!

CoolCapri commented 11 years ago

Now I display the error message (temporarily) as errorMessage = "Error getting directions: " + dReq.getErrorMessages() + "--" + dReq.getExtendedErrorMessages();

However, there are still some work to be polished for the two functions. For example, if I press find when there is no connection, I get:

Error getting directions: null--Having trouble connecting to the server. Please try again laterHaving trouble connecting to the server. Please try again later

instead of

Error getting directions: Having trouble connecting to the server. Please try again later--Having trouble connecting to the server. Please try again later

By the way, how to we define what is "extended"? Does it mean "detailed"?

CoolCapri commented 11 years ago

It seems like we are still appending "Having trouble connecting to the server. Please try again later" two times to errorMassages now. If it is unavoidable in backend, I can trim it in search activity.

dutchscout commented 11 years ago

Do we ever want to show more than one error to the user?

I'm tempted to simply cut out the extra string errors. If there is an error, we can display one to the user. Is this ok for everyone?

dutchscout commented 11 years ago

OK. I have modified DirectionsRequest to remove extendedErrorMessages and rename the main getErrorMessages to getVerboseErrorMessages. I also changed the search activity to display only the text-version of the return value to the user.