Method: Net::TOC::Client#on_error
- Defined in:
- lib/aim/net_toc.rb
#on_error ⇒ Object
Pass a block to be called every time an error occurs. This will replace any previous on_error handler, including the default exception-raising behavior.
546 547 548 549 550 551 552 553 554 555 |
# File 'lib/aim/net_toc.rb', line 546 def on_error raise ArgumentException, "on_error requires a block argument" unless block_given? add_callback(:error) do |val| code, param = *val.split(":") error = ErrorCode[code.to_i] error = "An unknown error occurred." if error.nil? error.gsub!("<param>", param) unless param.nil? yield error end end |