r404 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +14 -0
- data/lib/r404/access_denied.rb +1 -1
- data/lib/r404/not_found.rb +1 -1
- data/lib/r404/version.rb +1 -1
- metadata +30 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c50669df13ac9b55b848e9f2fa915b35d9aece01232a13c7d0dec68af65b8bb
|
4
|
+
data.tar.gz: a10ec7157a3f5c5d974b58508cb8af41221978c00686ac3b4af72d9e99347fb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7215b5965a53a53d9944507829001e3ede0a8ce88a9c89af445fc99cd678f9ab3dcc8ac4d5028d9eac4db70620d5ead1be969c13f538746beaa33e84675600f9
|
7
|
+
data.tar.gz: 6458ecc9da58f8b2319650ea69c5f15cd37abf2d58591d47fbec4798c8297c76304f1f4917dba24e3e571ce6cf96efa55cf0b478cb4a36bed444e4aa3be830dc
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -12,6 +12,7 @@ An error handler & renderer for Rails.
|
|
12
12
|
* [Usage](#usage)
|
13
13
|
* [Raising an error](#raising-an-error)
|
14
14
|
* [Rendering an error](#rendering-an-error)
|
15
|
+
* [Rendering external errors](#rendering-external-errors)
|
15
16
|
* [List of all error classes](#list-of-all-error-classes)
|
16
17
|
* [To Do](#to-do)
|
17
18
|
* [Contributing](#contributing)
|
@@ -92,6 +93,19 @@ def render_r404_access_denied format, status, exception
|
|
92
93
|
end
|
93
94
|
```
|
94
95
|
|
96
|
+
#### Rendering external errors
|
97
|
+
|
98
|
+
A lot of errors can be thrown in a Rails application. You can rescue and render them from your `ApplicationController`, here is a very basic configuration:
|
99
|
+
|
100
|
+
```ruby
|
101
|
+
rescue_from CanCan::AccessDenied do |exception|
|
102
|
+
render_r404 :access_denied, 403, exception
|
103
|
+
end
|
104
|
+
rescue_from ActiveRecord::RecordNotFound, AbstractController::ActionNotFound, ActionController::RoutingError do |exception|
|
105
|
+
render_r404 :not_found, 404, exception
|
106
|
+
end
|
107
|
+
```
|
108
|
+
|
95
109
|
### List of all error classes
|
96
110
|
|
97
111
|
* `R404::AccessDenied` (`:access_denied`, `403`)
|
data/lib/r404/access_denied.rb
CHANGED
data/lib/r404/not_found.rb
CHANGED
data/lib/r404/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: r404
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonas Hübotter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -24,6 +24,34 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '5.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '5.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '5.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: actionpack
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.0'
|
27
55
|
- !ruby/object:Gem::Dependency
|
28
56
|
name: rspec
|
29
57
|
requirement: !ruby/object:Gem::Requirement
|