support onError callback