2015-11-02 17:33:25 +03:00
|
|
|
require "json"
|
2015-10-09 15:00:21 +03:00
|
|
|
module Devops
|
|
|
|
|
module Exception
|
|
|
|
|
|
|
|
|
|
class DevopsError < StandardError
|
|
|
|
|
|
2015-11-02 17:33:25 +03:00
|
|
|
def http_status
|
2015-10-09 15:00:21 +03:00
|
|
|
500
|
|
|
|
|
end
|
|
|
|
|
|
2015-11-02 17:33:25 +03:00
|
|
|
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
|
|
|
|
|
|
2015-10-09 15:00:21 +03:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
end
|