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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc6e6557052a8a89d2cef3beb454a9496d6581fabe2432f9bb86319e810d58dc
4
- data.tar.gz: 933b900e2c34b746e3e99f6aedd71519b1262230cff073dffc52c0536faad94c
3
+ metadata.gz: 6c50669df13ac9b55b848e9f2fa915b35d9aece01232a13c7d0dec68af65b8bb
4
+ data.tar.gz: a10ec7157a3f5c5d974b58508cb8af41221978c00686ac3b4af72d9e99347fb9
5
5
  SHA512:
6
- metadata.gz: c6def4e9cad4d39b550357807cbee510319896c1107320d17124d295dd8be7992541e4f1b7879309a475df64a31df64a64732e93191f93cc9a6f8952a64e4067
7
- data.tar.gz: ff5098e3b4a191218b8c707b111ae62a1dabe6ddac7d980be07a4754092a71665ce0fcab54d1cc335f48f07f78262e28a73de77fe6b6593024471c358591572f
6
+ metadata.gz: 7215b5965a53a53d9944507829001e3ede0a8ce88a9c89af445fc99cd678f9ab3dcc8ac4d5028d9eac4db70620d5ead1be969c13f538746beaa33e84675600f9
7
+ data.tar.gz: 6458ecc9da58f8b2319650ea69c5f15cd37abf2d58591d47fbec4798c8297c76304f1f4917dba24e3e571ce6cf96efa55cf0b478cb4a36bed444e4aa3be830dc
data/CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@
4
4
 
5
5
  * nothing yet
6
6
 
7
+ ### 1.0.1 - 2018/01/26
8
+
9
+ * bugfixes
10
+ * fixed raising errors without `exception` parameter
11
+
7
12
  ### 1.0.0 - 2018/01/20
8
13
 
9
14
  * initial release
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`)
@@ -1,7 +1,7 @@
1
1
  module R404
2
2
  class AccessDenied < StandardError
3
3
 
4
- def initialize exception
4
+ def initialize exception = nil
5
5
  super
6
6
  end
7
7
 
@@ -1,7 +1,7 @@
1
1
  module R404
2
2
  class NotFound < StandardError
3
3
 
4
- def initialize exception
4
+ def initialize exception = nil
5
5
  super
6
6
  end
7
7
 
data/lib/r404/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module R404
2
2
 
3
- VERSION = '1.0.0'
3
+ VERSION = '1.0.1'
4
4
 
5
5
  end
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.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-20 00:00:00.000000000 Z
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