Add custom inspect to Google::Apis:Error (#729)
Add the status_code, header, and body values to inspect when present. These values can help users understand why they are getting errors, but many users don't know to look for them. Adding the values to inspect should help discoverability.
This commit is contained in:
parent
df67c60740
commit
d6247a7794
|
@ -41,6 +41,15 @@ module Google
|
|||
super
|
||||
end
|
||||
end
|
||||
|
||||
def inspect
|
||||
extra = ""
|
||||
extra << " status_code: #{status_code.inspect}" unless status_code.nil?
|
||||
extra << " header: #{header.inspect}" unless header.nil?
|
||||
extra << " body: #{body.inspect}" unless body.nil?
|
||||
|
||||
"#<#{self.class.name}: #{message}#{extra}>"
|
||||
end
|
||||
end
|
||||
|
||||
# An error which is raised when there is an unexpected response or other
|
||||
|
|
Loading…
Reference in New Issue