diff --git a/lib/clients/public.js b/lib/clients/public.js index 8e508d61..448ddd00 100644 --- a/lib/clients/public.js +++ b/lib/clients/public.js @@ -63,6 +63,7 @@ class PublicClient { if (err) { err.response = response; + err.data = data; } else if (response.statusCode > 299) { err = new Error( `HTTP ${response.statusCode} Error: ${data && data.message}` @@ -72,6 +73,7 @@ class PublicClient { } else if (data === null) { err = new Error('Response could not be parsed as JSON'); err.response = response; + err.data = data; } if (typeof callback === 'function') {