More flexible error handling