Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MAINT: show responseText when applicable in alerts
This necessitated some messing around with each of the three onRejected functions I added in 77cb5a6 in order to figure out which arguments were passed where. ERROR FUNCTIONS 1 AND 2 For the most part, any error functions that fail due to requests (i.e. the error functions I just created in autocomplete_search_samples() and in get_active_samples()) are passed a jqXHR, etc. as arguments -- so we can just show the responseText. (These error functions, if ever called, should be called with a jqXHR since all they're really doing is waiting on a series of requests to finish. I *guess* it's conceivably possible they could fail not due to a request if jQuery's code somehow explodes, but I doubt it.) ERROR FUNCTION 3 The callback on the promise returned by get_active_samples() -- that is, the error function declared in modifyWell() -- just receives a normal rejectionReason as a string if there's an error in the success function within get_active_samples(), which makes sense since if any of the requests would fail in get_active_samples() then that would trigger get_active_samples()' declared error function (with a jqXHR, etc. as arguments since a request caused the failure) instead of the error function on the promise returned by get_active_samples(). TLDR Phew! That was a lot of long paragraphs. The gist of things here is: I tested each of the 3 new error callbacks locally, saw what the responses I was getting were, and adjusted the bootstrapAlert() calls accordingly to be more informative. From manual testing and thinking things through these adjustments should be correct, but even if they aren't (and, say, error function 1 gets passed a string instead of a jqXHR and things) then the outcome is the same: an error pops up with some sort of message. (The difference in that case will be we'll see something like "[Nice error message:] undefined" instead of "[Nice error message:] [further information]", which isn't too horrifying.)
- Loading branch information