Commit 720ff31
committed
Add error handling to Tacos model
** Why are these changes being introduced:
I realized that the Tacos model as originally proposed had no error
handling when I refreshed a results page without my local TACOS app
running. The result was a pretty ugly blob shown to the user.
** Relevant ticket(s):
* https://mitlibraries.atlassian.net/browse/use-66
** How does this address that need:
This adds two catch statements to the call to TACOS - one for an HTTP
error response, and one for a JSON parsing error.
It also refactors the Tacos model to allow a separately-defined HTTP
object, which we craft in the test suite to always return those two
error conditions.
** Document any side effects to this change:
This is yet another pattern for error handling, not using VCR cassettes
or webmock, neither of which I could get working this afternoon. I'm
not happy about that, but this does work.1 parent a870cd4 commit 720ff31
2 files changed
+61
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
7 | 7 | | |
8 | | - | |
9 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
10 | 16 | | |
11 | 17 | | |
12 | 18 | | |
| |||
23 | 29 | | |
24 | 30 | | |
25 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
26 | 42 | | |
27 | 43 | | |
28 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
3 | 23 | | |
4 | 24 | | |
5 | 25 | | |
| |||
21 | 41 | | |
22 | 42 | | |
23 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
24 | 62 | | |
0 commit comments