falcon 0.3.0 → 0.3.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
  SHA1:
3
- metadata.gz: cb0d5a4e2397edf4b80bfb5700d2032b5cf73b93
4
- data.tar.gz: aa3b86a2d8d000b5e26c7ce2c2d67de3b43959e8
3
+ metadata.gz: 1ad0fb3facc056827b3f6d86b9f7d3dbd8c8e8a7
4
+ data.tar.gz: 11fd7d0b44d280815bbae15a6278594f788324fd
5
5
  SHA512:
6
- metadata.gz: 9061371a25b049f64f5648277bf9d0d13e8c0866f87e72a6f3d9042e9357c2aa716ca44d0263d5fec986bba20e069bddc0820dd7210394d73e6094bfef211e3e
7
- data.tar.gz: 11ed32abb1a9498bc8ea96b8cb0c5e413a3ebe01f65b9a4656ae2da4450afd7aa1eac6d12b7fd2f332411925af7b2a0b63f790d2a29615d699db33920f47c53d
6
+ metadata.gz: 2dd102500ba56111af17b1237a7b9ac6d0d65428fb58ebb3cb685bef2beb493ab5379310edbad5553470c51eda490f32a4296f563dc7c6d3686287143bf0c077
7
+ data.tar.gz: 937b96dc8903ec42c5e7572c29c83ff7e2fc18c10eff01a759cb240d8a05fc9a91cef5a620719573583a4af5602d01b11ad6da620f192ae37f70656a3309cb78
data/.gitignore CHANGED
@@ -1,3 +1,5 @@
1
+ .tags
2
+
1
3
  /.bundle/
2
4
  /.yardoc
3
5
  /Gemfile.lock
@@ -28,6 +28,10 @@ module Falcon
28
28
  @app = app
29
29
  end
30
30
 
31
+ def logger
32
+ Async.logger
33
+ end
34
+
31
35
  def handle_request(request, peer, address)
32
36
  request_path, query_string = request.path.split('?', 2)
33
37
  server_name, server_port = request.headers.fetch('HTTP_HOST', '').split(':', 2)
@@ -70,9 +74,14 @@ module Falcon
70
74
  end
71
75
 
72
76
  return @app.call(env)
73
- rescue
74
- $stderr.puts "handle_request: #{$!.inspect} (#{$!.backtrace.first})"
75
- [500, {'Content-Type' => 'text/plain'}, [$!.inspect, "\n", $!.backtrace.join("\n\t")]]
77
+ rescue => exception
78
+ logger.error "#{exception.class}: #{exception.message}\n\t#{$!.backtrace.join("\n\t")}"
79
+
80
+ return failure_response(exception)
81
+ end
82
+
83
+ def failure_response(exception)
84
+ [500, {'Content-Type' => 'text/plain'}, ["Request failed due to: #{exception.class}: #{exception.message}"]]
76
85
  end
77
86
  end
78
87
  end
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Falcon
22
- VERSION = "0.3.0"
22
+ VERSION = "0.3.1"
23
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: falcon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-16 00:00:00.000000000 Z
11
+ date: 2017-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async-http