Improve error handling in debug objgraph gateway resource.