Fix including a non-existing directory exception requires path information.

Fixes #5618