How to handle not-null constaints errors on ErrorHandling middleware?

I have followed the docs to implement a middleware for handling resolution errors and returning formatted error messages: Writing Middleware and Plugins — absinthe v1.7.0

However, I noticed that when my resolver returns nil for a not null field, the error is fired but not “caught” by the object-wide middleware. Debugging a little bit I found that the Resolution phase performs not null checking after running the middleware

What would be the best way to catch those errors to report/format? I’ve tried to implement another custom middleware to perform null-check before the error middleware, following the code on the Resolution phase, but it was not straightforward. Another option would be to implement a custom phase to catch that error specifically, but it doesn’t look very clean.

Any suggestions are highly appreciated, thanks!

@benwilson512 Could you shed some light when you have some time? I’m still not sure what is the best way to address this issue. Thanks!