Move this constructor logic to a `public static` method of the exception, so that it is easier to tweak it later on.

`var_export` is no-go, since it is possible that there may be recursions in the object.