diff options
author | Jamis Buck <jamis@37signals.com> | 2008-04-08 08:22:39 -0600 |
---|---|---|
committer | Jamis Buck <jamis@37signals.com> | 2008-04-08 08:22:39 -0600 |
commit | 73e7a6164730051cca2555ed70b0c34935049514 (patch) | |
tree | 3e9a616c06ec1583a6ca99d4efd11a99220a761b | |
parent | 70c5e93084ed2e786e62c48bbfeaf8bad48534a2 (diff) | |
download | net-ssh-multi-73e7a6164730051cca2555ed70b0c34935049514.tar.gz |
allow on_error to be a proc, and use throw/catch to support programmatic retry/reraise
-rw-r--r-- | lib/net/ssh/multi/session.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/net/ssh/multi/session.rb b/lib/net/ssh/multi/session.rb index 6c31dea..4c6e1a0 100644 --- a/lib/net/ssh/multi/session.rb +++ b/lib/net/ssh/multi/session.rb @@ -381,6 +381,14 @@ module Net; module SSH; module Multi # do nothing when :warn then warn("error connecting to #{server}: #{e.class} (#{e.message})") + when Proc then + go = catch(:go) { on_error.call(server); nil } + case go + when nil, :ignore then # nothing + when :retry then retry + when :raise then raise + else warn "unknown 'go' command: #{go.inspect}" + end else raise end |