Allow user to pass in onload event for error handling