Add onError option