Skip to content
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

Error handling #18

Open
AzHicham opened this issue Sep 1, 2023 · 4 comments
Open

Error handling #18

AzHicham opened this issue Sep 1, 2023 · 4 comments

Comments

@AzHicham
Copy link
Contributor

AzHicham commented Sep 1, 2023

Hello,

It could be really nice to add error handling while fetching.
eg. For Dataset that reads data from IO file/http .....
Currently we can only unwrap/expect.
One solution could be to allow fetch to return a Result. And then collat if all Result are Ok
Iterator then return a Result<Batch, Self::E>

@AzHicham
Copy link
Contributor Author

@Tudyx WDYT of this ?

@Tudyx
Copy link
Owner

Tudyx commented Sep 16, 2023

I'm kind of mitigated of this, I'm afraid it will deteriorate the API. For files we can panic, it will be more or less equivalent about how python handle this case.
For network, it makes more sense to define another trait, an async one, and then we can put a Result on this one.

But I'm not close to this, if this is a really wanted feature I might change my mind.

@AzHicham
Copy link
Contributor Author

AzHicham commented Sep 16, 2023

Ok I un understand your POV.
Right now I'm using ai-dataloader to load data through network (a server allow me to retrieve images).
Using async cool be a great addition indeed !

@AzHicham
Copy link
Contributor Author

Another detail is that in python we can throw exceptions when we get_samples, and catch it in the main program.
However this cannot be done in rust without using Result (ie only using unwrap)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants