lib/arborist/client.rb in arborist-0.2.0 vs lib/arborist/client.rb in arborist-0.3.0
- old
+ new
@@ -310,10 +310,11 @@
res = CZTop::Message.receive_from( self.tree_api )
self.log.debug "Received response: %p" % [ res ]
header, body = Arborist::TreeAPI.decode( res )
unless header[ 'success' ]
- raise "Arborist manager said: %s" % [ header['reason'] ]
+ exception = header['category'] == 'client' ? Arborist::ClientError : Arborist::ServerError
+ raise exception, "Arborist manager said: %s" % [ header['reason'] ]
end
return body
end