rbbt-rest 1.3.16 → 1.3.17

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: 62f875a6b4351919548f892321674b3ce9a22e12
4
- data.tar.gz: aa633b3530d33f74724aaf4d5c4b25d8413aab3d
3
+ metadata.gz: b087f8339e7a65c9e44b765d5b78d656fe9e613d
4
+ data.tar.gz: e1eef5d17962223f05ea3e5b65aea531e1cf389c
5
5
  SHA512:
6
- metadata.gz: d60256136e670dd80fa34cfd127ef1388fd4769b63a3aa5e329edcef8fba09efb3b563fdbbfad8160ce7f2e771aa1e8a5e1290fca6ed68b26acadc4afc21d7ae
7
- data.tar.gz: eebc38fd2caa1ee4fddf9ae3df434619927de27294cf124f250c86d5326b88784635ff613a7f30b3993411702e52a999ed18dc9d82dc5325eef4bf7d1e19e9c9
6
+ metadata.gz: 2ba5c13c66439f9e9ea52535790b449cd050cf93a45b962be5266551e97928ccdcf7bb9065e5f8ccf2a5d3cf39b3d99fe6ef8cfa0a8079cdf4eaa7a57aef7422
7
+ data.tar.gz: 5cb298f5e8d58ef8f391a48f58e98b031200d445ca218b7f6fbe8743985e03e354ffe0362f3eaa90a4ce84d8b21404f3e413da0e4db1332bc8c5fd43e8113a44
@@ -4,9 +4,20 @@ require 'tilt'
4
4
 
5
5
  module RbbtRESTHelpers
6
6
  def error_for(job, layout = nil)
7
- if @format == :json
8
- halt 400, {"message" => job.messages[-2], "backtrace" => job.info[:backtrace]}.to_json
7
+ if ex = job.info[:exception]
8
+ klass = ex[:class]
9
+ msg = ex[:message]
10
+ bkt = ex[:backtrace]
9
11
  else
12
+ klass = "Exception"
13
+ msg = job.messages[-1]
14
+ bkt = []
15
+ end
16
+
17
+ case @format
18
+ when :json
19
+ halt 400, {"message" => msg, "backtrace" => bkt}.to_json
20
+ when :html
10
21
  layout = @layout if layout.nil?
11
22
  layout_file = (layout ? locate_template('layout') : nil)
12
23
  template_file = locate_template('error')
@@ -14,6 +25,8 @@ module RbbtRESTHelpers
14
25
  result = render template_file, {:job => job}, layout_file
15
26
 
16
27
  halt 400, result
28
+ else
29
+ halt 400, "#{klass}: " << msg << "\nBacktrace: " << btk * "\n"
17
30
  end
18
31
  end
19
32
 
@@ -176,7 +176,7 @@ module WorkflowRESTHelpers
176
176
  else
177
177
  redirect job_url
178
178
  end
179
- rescue
179
+ rescue Exception
180
180
  Log.exception $!
181
181
  halt 500, $!.message
182
182
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbt-rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.16
4
+ version: 1.3.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-12 00:00:00.000000000 Z
11
+ date: 2014-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake