dropbox-sdk-ruby icon indicating copy to clipboard operation
dropbox-sdk-ruby copied to clipboard

Rely on Exception#message rather than overloading with attr_reader

Open josh-lauer opened this issue 7 years ago • 0 comments

Ruby implements a method, Exception#message, which returns the result of calling #to_s on the exception object: https://ruby-doc.org/core-2.2.0/Exception.html#method-i-message

In the ApiError class, the constructor in some cases sets @message to be an HTTP::Response object. Removing the message attr_reader allows Exception#message to be called instead, which in turn calls #to_s. This change ensures that #message always returns a string, rather than sometimes unexpectedly returning an HTTP::Response object.

josh-lauer avatar Aug 08 '17 12:08 josh-lauer