-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
…4 #TI5
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,7 @@ def initialize(hash_object) | |
@hash_object = IdiomaticRubyWrapper(hash_object.clone.freeze) | ||
end | ||
|
||
%w(message code status_code).each do |attribute| | ||
%w(message code href status_code).each do |attribute| | ||
define_method attribute do | ||
attributes[attribute.to_sym] | ||
end | ||
|
@@ -50,7 +50,8 @@ def attributes | |
end | ||
|
||
def to_s | ||
"<Error: #{message} (code: #{code}, http status: #{status})>" | ||
see_msg = " -> see https://help.ably.io/error/#{code} for help" if code | ||
"<Error: #{message} (code: #{code}, http status: #{status})>#{see_msg}" | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
mattheworiordan
Author
Member
|
||
end | ||
end | ||
end |
In the work Paddy did, for protocolversions < 1.2, realtime also adds help text with the message, so people on pre-1.2 client libraries see it. So this is going to look like
<Error: Invalid key in request (See https://help.ably.io/error/40005 for help.) (code: 40005, http status: 400)> -> see https://help.ably.io/error/40005 for help
.TBH I still don't really follow why we want make it the client lib's responsibility to add the url to the message (at least for errors received from realtime). Why not just let realtime do it? But if we are then at least we should only do it in v1.2 client libraries (for realtime-received errors, easily detectable here as the errorinfo will have an
href
field), to avoid the doubling-up.(Also, this should use the
href
field if present, rather than constructing it from the code)