mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +03:00
Improve error handling
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
var enhanceError = require('../../../lib/core/enhanceError');
|
||||
|
||||
describe('core::enhanceError', function() {
|
||||
it('should add config and code to error', function() {
|
||||
var error = new Error('Boom!');
|
||||
enhanceError(error, { foo: 'bar' }, 'ESOMETHING');
|
||||
expect(error.config).toEqual({ foo: 'bar' });
|
||||
expect(error.code).toBe('ESOMETHING');
|
||||
});
|
||||
|
||||
it('should return error', function() {
|
||||
var error = new Error('Boom!');
|
||||
expect(enhanceError(error, { foo: 'bar' }, 'ESOMETHING')).toBe(error);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user