anyerr
v0.0.1
Published
Get the message from any error of all shapes and sizes! Anyerr will traverse through deeply-nested error objects to find the error message.
Downloads
1
Readme
anyerr
Get the message from any error of all shapes and sizes! Anyerr will traverse through deeply-nested error objects to find the error message.
import { parseAnyError } from '../src/index';
import axios from 'axios';
async function doSomething() {
try {
await axios.get('http://example.com');
} catch (ex) {
const { message } = parseAnyError(ex);
console.error('Error while doing something:', message);
}
}