mirror of
https://github.com/tenrok/axios.git
synced 2026-06-14 18:42:33 +03:00
Improve error handling
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
var createError = require('../../../lib/core/createError');
|
||||
|
||||
describe('core::createError', function() {
|
||||
it('should create an Error with message, config, and code', function() {
|
||||
var error = createError('Boom!', { foo: 'bar' }, 'ESOMETHING');
|
||||
expect(error instanceof Error).toBe(true);
|
||||
expect(error.message).toBe('Boom!');
|
||||
expect(error.config).toEqual({ foo: 'bar' });
|
||||
expect(error.code).toBe('ESOMETHING');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user