switch on error to allow more control