encode / apistar

The Web API toolkit. 🛠
https://docs.apistar.com
BSD 3-Clause "New" or "Revised" License
5.57k stars 411 forks source link

Load components from cache when calling error hooks #625

Closed Bogdanp closed 5 years ago

Bogdanp commented 5 years ago

This fixes an issue where on_error hooks don't have access to the same component instances as other hooks and handlers. In addition, this may fix other resolution issues/heisenbugs but I was mainly concerned with fixing on_error as any code right now that tries to clean up resources on error (eg. db connections) based on a component instance is probably incorrect.

Bogdanp commented 5 years ago

I think this issue was correctly identified in https://github.com/encode/apistar/issues/490, but mistakenly characterised as "fixed". It would appear to be fixed by the change that was made to pass state around, but that isn't the case as you can see from my changes to the injector.