Controlling axios HTTP error handling and test it using nock + Jest.
Axios is a popular Promises based HTTP client library. It offers nice abstraction over the core node http module. This post explains the default error propagation mechanism of axios library, and how to control it using the axios request configuration. Finally, how you can test all these using nock, HTTP mocking library and Jest test library.