change error handling so errorURL is called in error function