Commit 1e002a3
committed
refactor: Clean up and simplify TokenOwnerResolver implementation
Remove dead code and improve error handling:
- Remove fetch_endpoint_helpers: Endpoints don't have a public helpers method,
making this code path unreachable
- Simplify resolve_from_helper: Remove non-Module branch since helpers from
namespace_stackable are always Modules
- Simplify gather_helpers: Only one source of helpers (stackable), remove
unnecessary array consolidation
- Remove __send__ usage: inheritable_setting is a public method, use direct call
- Improve exception handling: Replace broad rescue StandardError with specific
NoMethodError and NameError catches in fetch_stackable_helpers
Error handling improvements:
- Add GrapeSwagger::Errors::TokenOwnerNotFound inheriting from NoMethodError
for more semantic error hierarchy
- Update resolver to raise custom error instead of generic NoMethodError,
allowing users to catch grape-swagger-specific issues1 parent 66a7d51 commit 1e002a3
File tree
3 files changed
+80
-41
lines changed- lib/grape-swagger
- spec/lib
3 files changed
+80
-41
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | 30 | | |
37 | 31 | | |
38 | 32 | | |
| |||
48 | 42 | | |
49 | 43 | | |
50 | 44 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | 45 | | |
56 | | - | |
57 | | - | |
58 | | - | |
| 46 | + | |
59 | 47 | | |
60 | 48 | | |
61 | | - | |
62 | | - | |
63 | | - | |
| 49 | + | |
| 50 | + | |
64 | 51 | | |
65 | | - | |
66 | | - | |
| 52 | + | |
| 53 | + | |
67 | 54 | | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
| 55 | + | |
| 56 | + | |
72 | 57 | | |
73 | | - | |
74 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
75 | 61 | | |
76 | 62 | | |
77 | 63 | | |
| |||
93 | 79 | | |
94 | 80 | | |
95 | 81 | | |
96 | | - | |
97 | | - | |
| 82 | + | |
| 83 | + | |
98 | 84 | | |
99 | | - | |
100 | | - | |
101 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
102 | 88 | | |
103 | 89 | | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
109 | 93 | | |
110 | | - | |
111 | | - | |
| 94 | + | |
| 95 | + | |
112 | 96 | | |
113 | | - | |
114 | | - | |
115 | | - | |
| 97 | + | |
116 | 98 | | |
117 | 99 | | |
118 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
83 | 138 | | |
0 commit comments