-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add dataset.statistics #621
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine, I'm not sure about catchNotFoundOrThrow, I would expect that the method throw, why did you use it?
const response = await this.httpClient.call(requestOpts); | ||
return cast(pluckData(response.data)); | ||
} catch (err) { | ||
catchNotFoundOrThrow(err as ApifyApiError); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this, should be the same as listItems and return not found error once the dataset does not exist?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree it makes more sense to me too, but I got inspired by DatasetClient.get()
which doesn't throw if dataset not exists 🤔 (which I would expect to also throw)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also prefer throwing when things are not there, but we should be consistent, and it looks like most methods use the catchNotFoundOrThrow
approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
catchNotFoundOrThrow
feels confusing, if you get undefinied, you have no idea if the dataset does not exist or statistics missing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefere throw over catchNotFoundOrThrow, see discussion. But pre aproving as even catchNotFoundOrThrow makes sence if we want to be consistent.
Part of https://github.com/apify/apify-core/issues/18807 - Implementation of new API endpoint
v2/datasets/{datasetId}/statistics