Improve debug endpoint error checking with test case.