make rack tell you when a request goes wonky
This commit is contained in:
parent
668ef51cef
commit
b94df1c3a0
@ -1,7 +1,3 @@
|
||||
#= require_self
|
||||
#= require flowerbox/result
|
||||
#= require flowerbox/exception
|
||||
#
|
||||
Flowerbox =
|
||||
debug: false
|
||||
ping: ->
|
||||
@ -37,3 +33,25 @@ Flowerbox =
|
||||
|
||||
fail: ->
|
||||
|
||||
class Flowerbox.Exception
|
||||
constructor: (@source, @name, @stack) ->
|
||||
|
||||
toJSON: ->
|
||||
{ status: Flowerbox.Result.FAILURE, source: @source, name: @name, trace: { stack: @stack } }
|
||||
|
||||
class Flowerbox.Result
|
||||
@SUCCESS = 'success'
|
||||
@PENDING = 'pending'
|
||||
@UNDEFINED = 'undefined'
|
||||
@FAILURE = 'failure'
|
||||
@SKIPPED = 'skipped'
|
||||
|
||||
constructor: (data) ->
|
||||
for key, value of data
|
||||
this[key] = value
|
||||
|
||||
this.status ||= Flowerbox.Result.SKIPPED
|
||||
this.failures ||= []
|
||||
|
||||
toJSON: => this
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
class Flowerbox.Exception
|
||||
constructor: (@source, @name, @stack) ->
|
||||
|
||||
toJSON: ->
|
||||
{ status: Flowerbox.Result.FAILURE, source: @source, name: @name, trace: { stack: @stack } }
|
@ -1,17 +0,0 @@
|
||||
Flowerbox ||= {}
|
||||
|
||||
class Flowerbox.Result
|
||||
@SUCCESS = 'success'
|
||||
@PENDING = 'pending'
|
||||
@UNDEFINED = 'undefined'
|
||||
@FAILURE = 'failure'
|
||||
@SKIPPED = 'skipped'
|
||||
|
||||
constructor: (data) ->
|
||||
for key, value of data
|
||||
this[key] = value
|
||||
|
||||
this.status ||= Flowerbox.Result.SKIPPED
|
||||
this.failures ||= []
|
||||
|
||||
toJSON: => this
|
@ -17,7 +17,18 @@ module Flowerbox
|
||||
|
||||
result
|
||||
else
|
||||
[ 200, { 'Content-type' => 'text/html' }, [ runner.template ] ]
|
||||
begin
|
||||
template = runner.template
|
||||
|
||||
[ 200, { 'Content-type' => 'text/html' }, [ template ] ]
|
||||
rescue => e
|
||||
$stderr.puts
|
||||
$stderr.puts e.message
|
||||
$stderr.puts e.backtrace.join("\n")
|
||||
$stderr.puts
|
||||
|
||||
[ 500, {}, [] ]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user