lastError should be null by default.
Set self::lastError on script errors.