module Sprockets::Server

def javascript_exception_response(exception)

in the browser
Returns a JavaScript response that re-throws a Ruby exception
def javascript_exception_response(exception)
  err  = "#{exception.class.name}: #{exception.message}"
  body = "throw Error(#{err.inspect})"
  [ 200, { "Content-Type" => "application/javascript", "Content-Length" => Rack::Utils.bytesize(body).to_s }, [ body ] ]
end