kriasoft / universal-router

A simple middleware-style router for isomorphic JavaScript web apps
https://www.kriasoft.com/universal-router/
MIT License
1.7k stars 104 forks source link

Error handler with context #158

Closed frenzzy closed 5 years ago

frenzzy commented 5 years ago

The router no longer mutate errors to avoid issues with non-extensible objects. If your code relies on error.context or error.code you still can access the same variables using errorHandler option:

errorHandler(error, context) {
  const code = error.status || 500
  console.log(error, context, code)
}

Types of changes

Checklist:

Closes #152 Closes #154 Closes #156

codecov-io commented 5 years ago

Codecov Report

Merging #158 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #158   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           4      4           
  Lines         147    144    -3     
  Branches       44     42    -2     
=====================================
- Hits          147    144    -3
Impacted Files Coverage Δ
src/UniversalRouter.js 100% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update b5f7dbf...b61f561. Read the comment docs.