Stores error text in separate variable

Fixes #350 by storing our error text in the $errorText variable, then generating the error from this new location.