refactor DebugExceptions by combining two conditionals into one