27 lines
		
	
	
		
			413 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			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
 | 
