Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Added toJSON to enhanced Axios errors to facilitate serialization #1625
Other Error objects in JSON are serializable by default using
This is particularly problematic because conditions that result in errors are less likely to occur during the normal course of operation (i.e. when testing the 'happy path'), and so the corresponding code paths are less often tested. When they are tested, they may be tested with mocks that do not include the circular structures, and therefore this behavior is not detected until the corresponding error condition actually occurs in a production environment.
Prior to this change, the following would result in
After the change, the output is: