Error Handling in Async Code
What error handling utility is implemented here?
async function withErrorMapping(fn, errorMap) {
try {
return await fn();
} catch (error) {
const mapper = errorMap[error.name] || errorMap.default;
throw mapper ? mapper(error) : error;
}
}