We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 1f5658d + cf54459 commit a46cfceCopy full SHA for a46cfce
index.js
@@ -326,9 +326,12 @@ helpers.forEach(function (el) {
326
});
327
328
function stdError(error, opts) {
329
+ if (error.code !== undefined) {
330
+ this.code = error.code;
331
+ }
332
+
333
objectAssign(this, {
334
message: error.message,
- code: error.code,
335
host: opts.host,
336
hostname: opts.hostname,
337
method: opts.method,
test/error.js
@@ -23,6 +23,7 @@ test('properties', async t => {
23
t.ok(err);
24
t.ok(err.response);
25
t.ok(!err.propertyIsEnumerable('response'));
26
+ t.ok(!err.hasOwnProperty('code'));
27
t.is(err.message, 'Response code 404 (Not Found)');
28
t.is(err.host, `${s.host}:${s.port}`);
29
t.is(err.method, 'GET');
0 commit comments