refactor DebugExceptions by combining two conditionals into one
Merge pull request #8785 from goshakkk/refactor-debug-exceptions

Refactor DebugExceptions