schneiderlein 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/lib/schneiderlein.rb +1 -0
- data/lib/schneiderlein/catch.rb +4 -1
- data/lib/schneiderlein/extract_rexml_error_message.rb +15 -0
- data/lib/schneiderlein/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 485f339546ece6ac2be7153b123a9ad5d0def2c2
|
4
|
+
data.tar.gz: 64fb1c8788ce099c5987cf545e4f7de4c42997b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f523951ceee8dfae428eedd226b67339d74966fb441d4f2b8dd066cd16b1147e61ca5d063887ca534c065c19f56990ada7da6dc98f7361baa656f01b21b2716d
|
7
|
+
data.tar.gz: d5f8703c6bd12b187ece58c4c810189b688b49cfa5037c529675b1ecde19b266a91c859da5c195af8c7b81e52fc10ae7126f266c80b9741c5579688b472f4f1a
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Schneiderlein [](https://travis-ci.org/Absolventa/schneiderlein)
|
1
|
+
# Schneiderlein [](https://travis-ci.org/Absolventa/schneiderlein)[](http://badge.fury.io/rb/schneiderlein)
|
2
2
|
|
3
3
|
**Schneiderlein** is a Rack middleware to catch parse errors coming from [ActionDispatch::ParamsParser](https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/middleware/params_parser.rb). Malformed XML presents a 500 Internal Server Error to your API consumer. It's hardly meaningful, should instead be in the 4xx range and most importantly: it's not helping.
|
4
4
|
|
@@ -30,5 +30,8 @@ The name **Schneiderlein** is derived from the fairytale »Das Tapfere Schneider
|
|
30
30
|
|
31
31
|
## Changelog
|
32
32
|
|
33
|
+
### 1.1.0
|
34
|
+
* compactified error message presentation
|
35
|
+
|
33
36
|
### 1.0.0
|
34
37
|
* Initial release
|
data/lib/schneiderlein.rb
CHANGED
data/lib/schneiderlein/catch.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
module Schneiderlein
|
2
|
+
class ExtractREXMLErrorMessage < Struct.new(:exception)
|
3
|
+
|
4
|
+
def to_s
|
5
|
+
sanitizer(exception.message)
|
6
|
+
end
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def sanitizer(str)
|
11
|
+
str.to_s.gsub!('#<REXML::ParseException: ', '').to_s[0..str.to_s.index('Last').to_i-2]
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: schneiderlein
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carsten Zimmermann
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-11-
|
12
|
+
date: 2014-11-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -93,6 +93,7 @@ files:
|
|
93
93
|
- lib/schneiderlein.rb
|
94
94
|
- lib/schneiderlein/catch.rb
|
95
95
|
- lib/schneiderlein/engine.rb
|
96
|
+
- lib/schneiderlein/extract_rexml_error_message.rb
|
96
97
|
- lib/schneiderlein/fly_catcher.rb
|
97
98
|
- lib/schneiderlein/version.rb
|
98
99
|
- lib/tasks/schneiderlein_tasks.rake
|