Browse Source

remove undefined code in errors

http2
Vsevolod Strukchinsky 9 years ago
parent
commit
cf54459257
  1. 5
      index.js
  2. 1
      test/error.js

5
index.js

@ -326,9 +326,12 @@ helpers.forEach(function (el) {
});
function stdError(error, opts) {
if (error.code !== undefined) {
this.code = error.code;
}
objectAssign(this, {
message: error.message,
code: error.code,
host: opts.host,
hostname: opts.hostname,
method: opts.method,

1
test/error.js

@ -23,6 +23,7 @@ test('properties', async t => {
t.ok(err);
t.ok(err.response);
t.ok(!err.propertyIsEnumerable('response'));
t.ok(!err.hasOwnProperty('code'));
t.is(err.message, 'Response code 404 (Not Found)');
t.is(err.host, `${s.host}:${s.port}`);
t.is(err.method, 'GET');

Loading…
Cancel
Save