Last active
August 29, 2015 14:00
-
-
Save laser/0a150158b53d28bda229 to your computer and use it in GitHub Desktop.
Barrister Error Code (Ruby)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# Client sends invalid parameters to server | |
require 'barrister' | |
trans = Barrister::HttpTransport.new("http://localhost:3000/v1/todos") | |
client = Barrister::Client.new(trans) | |
client.TodoManager.deleteTodo(45) # valid (45 is an int) | |
begin | |
client.TodoManager.deleteTodo("66") # invalid ("66" is a string, not an int) | |
rescue Barrister::RpcException => e | |
puts "err.code=#{e.code}" # -32602 ("Invalid params" - from the JSON-RPC 2.0 spec) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment