exceptionally 1.3.0 → 1.4.0

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
  SHA1:
3
- metadata.gz: 44b094f37c47b75c1044c96ee036150b75b1c7b3
4
- data.tar.gz: 258b592066c4d6f8b81d890d5b0bf4aca1e2bee0
3
+ metadata.gz: 1fdf16af0a2ab6008bdf4eecf66a1c80c62bc615
4
+ data.tar.gz: ebcf7d8e539ccd854e55574f4f1b33c6d3ffc709
5
5
  SHA512:
6
- metadata.gz: 96c6ebf1e2fff07e555905cf3ed56cb93f8aa1520f72dbb1019f4dec979e0aa8ff785b44c59648049270f4efddf3bb20c8aa0ba8a5a9f2dcff8d0b6e39a69ec5
7
- data.tar.gz: 6e80c773c2ea9d52484b5fb30ce1948cae60a46028e7c9be28212ce02e5120eb78eb34debdf24fc58a5bb203494d952bbb9b0768523dea072dbe126479396560
6
+ metadata.gz: 8aab8643a51a26b406b2f619d91daf01401a239b7cb3b299596938bda164c772e086a7a1b38002350d04b6da415514371ed020f3d9a1edd1890cad289a951011
7
+ data.tar.gz: 57bde5c707f43857bb75ee38c7622f56941e8536cf2da9e2336c8f5a08b442367715ae46eee065455ca27e4be55b2ce2233f65dfb3115dc90bed51c010bd4ce7
data/README.md CHANGED
@@ -92,22 +92,21 @@ Exceptionally will handle the following errors by default:
92
92
  * ActiveRecord::RecordInvalid
93
93
  * Apipie::ParamMissing (if using [Apipie](https://github.com/Apipie/apipie-rails))
94
94
  * Apipie::ParamInvalid (if using [Apipie](https://github.com/Apipie/apipie-rails))
95
- * Pundit::NotAuthorizedError (if using [Pundit](https://github.com/elabs/pundit))
96
95
  * Exceptionally errors (see below for available errors)
97
96
 
98
97
  If there are additional errors that you want to assign status codes to and pass to Exceptionally, you can add the following to the top of your `application_controller.rb`:
99
98
 
100
99
  ```ruby
101
- # Catch MyCustomModule::BadRequestException errors and pass them to Exceptionally
102
- rescue_from MyCustomModule::BadRequestException, :with => :custom_400_error
100
+ # Catch SomeGem::NotAuthorizedError errors and pass them to Exceptionally
101
+ rescue_from SomeGem::NotAuthorizedError, :with => :not_authorized_error
103
102
 
104
- # Tell Exceptionally you want this treated as a 400 error
105
- def custom_400_error(error)
106
- pass_to_error_handler(error, 400)
103
+ # Tell Exceptionally you want this treated as a 401 error
104
+ def not_authorized_error(error)
105
+ pass_to_error_handler(error, 401)
107
106
  end
108
107
  ```
109
108
 
110
- `pass_to_error_handler` takes a Ruby Exception object and an optional status code. If no status code is provided, it will default to 500.
109
+ `pass_to_error_handler` takes a Ruby Exception object and a status code. If no status code is provided, it will default to 500.
111
110
 
112
111
  ## Available Errors
113
112
 
@@ -14,9 +14,6 @@ module Exceptionally
14
14
  rescue_from Apipie::ParamMissing, :with => :missing_param
15
15
  rescue_from Apipie::ParamInvalid, :with => :invalid_param
16
16
  end
17
- if defined?(Pundit)
18
- rescue_from Pundit::NotAuthorizedError, with: :not_authorized_error
19
- end
20
17
  end
21
18
 
22
19
  # Raise custom error
@@ -29,11 +26,6 @@ module Exceptionally
29
26
  pass_to_error_handler(error, 400)
30
27
  end
31
28
 
32
- # Raise 401 error
33
- def not_authorized_error(error)
34
- pass_to_error_handler(error, 401)
35
- end
36
-
37
29
  # Raise 404 error
38
30
  def missing_record_handler(error)
39
31
  pass_to_error_handler(error, 404)
@@ -1,3 +1,3 @@
1
1
  module Exceptionally
2
- VERSION = "1.3.0"
2
+ VERSION = "1.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exceptionally
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neil Gupta
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-24 00:00:00.000000000 Z
11
+ date: 2015-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails