Details are here - but, if going from page-to-page directly (not stopping on the client) then you may wish to rethrow the error if it's appropriate (i.e., from the current function back to the caller).
See example 7 for an example of rethrowing an error.[
^]
If you'll be stopping at the client then $_SESSION is a good place as it will last as long as you wish but take care to drop the value as soon as possible as it will persist until they close the browser.