fluke/devops-service/exceptions/devops_error.rb
2015-11-02 17:33:25 +03:00

27 lines
413 B
Ruby

require "json"
module Devops
module Exception
class DevopsError < StandardError
def http_status
500
end
def http_response
[self.http_status, self.http_headers, self.http_body]
end
def http_body
JSON.pretty_generate(message: self.message)
end
def http_headers
{"Content-Type" => "application/json"}
end
end
end
end