You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,7 @@
6
6
*[#1227](https://github.com/ruby-grape/grape/pull/1227): Store `message_key` on Grape::Exceptions::Validation - [@stjhimy](https://github.com/sthimy).
7
7
*[#1232](https://github.com/ruby-grape/grape/pull/1232): Helpers are now available inside `rescue_from` - [@namusyaka](https://github.com/namusyaka).
8
8
*[#1237](https://github.com/ruby-grape/grape/pull/1237): Allow multiple parameters in `given`, which behaves as if the scopes were nested in the inputted order - [@ochagata](https://github.com/ochagata).
9
+
*[#1238](https://github.com/ruby-grape/grape/pull/1238): Call `after` of middleware on error - [@namusyaka](https://github.com/namusyaka).
Copy file name to clipboardExpand all lines: UPGRADING.md
+24Lines changed: 24 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,30 @@ Upgrading Grape
3
3
4
4
### Upgrading to >= 0.14.0
5
5
6
+
#### Changes to behavior of `after` method of middleware on error
7
+
8
+
The `after` method of the middleware is now called on error.
9
+
The following code would work correctly.
10
+
11
+
```ruby
12
+
classCustomMiddleware < Grape::Middleware::Base
13
+
defafter
14
+
puts"Yay!"
15
+
end
16
+
end
17
+
18
+
classAPI < Grape::API
19
+
use CustomMiddleware
20
+
21
+
get { raiseStandardError }
22
+
end
23
+
24
+
mock =Rack::MockRequest.env_for(?/)
25
+
API.new.call(mock) #=. Displaying the message correctly.
26
+
```
27
+
28
+
See [#1147](https://github.com/ruby-grape/grape/issues/1147) and [#1240](https://github.com/ruby-grape/grape/issues/1240) for discussion of the issues.
29
+
6
30
#### Changes to availability of DSL methods in filters
7
31
8
32
The `#declared` method of the route DSL is no longer available in the `before` filter. Using `declared` in a `before` filter will now raise `Grape::DSL::InsideRoute::MethodNotYetAvailable`.
0 commit comments