Browse Source

Add tests on nested errors

http2
Vsevolod Strukchinsky 10 years ago
parent
commit
e07977d18c
  1. 2
      test/test-error.js
  2. 2
      test/test-json.js

2
test/test-error.js

@ -27,6 +27,8 @@ tape('dns error message', function (t) {
got('.com', function (err) {
t.ok(err);
t.equal(err.message, 'Request to .com failed');
t.ok(err.nested);
t.equal(err.nested.message, 'getaddrinfo ENOTFOUND');
t.end();
});
});

2
test/test-json.js

@ -47,6 +47,8 @@ tape('json option wrap parsing errors', function (t) {
got(s.url + '/invalid', {json: true}, function (err) {
t.ok(err);
t.equal(err.message, 'Parsing ' + s.url + '/invalid response failed');
t.ok(err.nested);
t.equal(err.nested.message, 'Unexpected token /');
t.end();
});
});

Loading…
Cancel
Save