For someone not familiar with the pipeline and just arriving from a google search it's not clear that this needs to be run before the rest of the middleware that actually produces the error, and adding it later will appear to have no effect.