Fix tests crash in DebugMode recently introduced.

Now we keep the original error message type and just add more information to it.