Class: Jenkins2::BadRequestError
- Inherits:
-
Net::HTTPError
- Object
- Net::HTTPError
- Jenkins2::BadRequestError
- Defined in:
- lib/jenkins2/errors.rb
Instance Method Summary collapse
-
#initialize(res) ⇒ BadRequestError
constructor
A new instance of BadRequestError.
Constructor Details
#initialize(res) ⇒ BadRequestError
Returns a new instance of BadRequestError.
5 6 7 8 9 10 11 12 13 |
# File 'lib/jenkins2/errors.rb', line 5 def initialize(res) if res.body.nil? or res.body.empty? super('', res) elsif (match = res.body.match('<h1>Error</h1><p>(.*)</p>')) super(match[1], res) elsif (match = res.body.match('<h2>HTTP ERROR 404</h2>\n<p>(.*) Reason:')) super(match[1], res) end end |