diff options
author | Christoph Helma <helma@in-silico.ch> | 2012-02-29 15:06:27 +0000 |
---|---|---|
committer | Christoph Helma <helma@in-silico.ch> | 2012-02-29 15:06:27 +0000 |
commit | f0d38b06cbdcfd59494c220e6f4685f2e5aa38fd (patch) | |
tree | 9b763dc4c82e817e6267a7c8f86d57994b3e1b79 /lib/error.rb | |
parent | f40871b9b60ae706c0668c9ac4cfbfff866ce5dc (diff) |
logging in error.rb, dynamic class methods in rest-client-wrapper.rb
Diffstat (limited to 'lib/error.rb')
-rw-r--r-- | lib/error.rb | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/error.rb b/lib/error.rb index 1866585..b832ef4 100644 --- a/lib/error.rb +++ b/lib/error.rb @@ -1,6 +1,15 @@ # adding additional fields to Exception class to format errors according to OT-API +=begin class Exception +end +=end + +class RuntimeError attr_accessor :errorCause # is errorReport + def initialize msg=nil + $logger.error msg + super msg + end def http_code; 500; end end @@ -26,13 +35,15 @@ module OpenTox def http_code; 503; end end - # TODO: add to RestClientCalls class RestCallError < RuntimeError - attr_accessor :rest_params + def initialize request, response, expectation=nil + msg = "REST request: #{request.inspect}\nREST response: #{response.inspect}" + msg += "\n"+expectation if expectation + super msg + end def http_code; 502; end end - # TODO: add to Exception class?? class ErrorReport # TODO replace params with URIs (errorCause -> OT.errorCause) |