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

printer Error type #21

Closed
liamwh opened this issue Sep 6, 2024 · 4 comments
Closed

printer Error type #21

liamwh opened this issue Sep 6, 2024 · 4 comments
Labels
FIXED Issue was fixed or implemented, and will be in the next release.

Comments

@liamwh
Copy link

liamwh commented Sep 6, 2024

I'm on mobile so please forgive the lack of formatting or examples, however I was getting issues with the error type from print_chat_stream being Box<dyn std::Error. Due to the fact that Box is used, the size of the error can not be known at compile time, meaning that the result of print_chat_stream is no longer Send + Sync, limiting its usage considerably. For example, I'd like to be able to use anyhow's Context trait on the result of print_chat_stream and propoagate it up the call stack using anyhow's Result type, but I believe that requires the error to be Send + Senc, though as I said I'm on mobile and not 100% certain there.

I'm not sure of the best practice solution here but I do know that most libraries use thiserror to which resolves this problem.

Would you please remove the Box from the error returned from print_chat_stream and perhaps anywhere else Box is used for errors?

@jeremychone
Copy link
Owner

@liamwh Ho yes, good one. I am going to fix that. It should not be Box<dyn..., it was a left over from before.

Good timing, I was going to do the 0.1.8 release.

Doing the commit now.

@jeremychone
Copy link
Owner

@liamwh Just pushed it. I am going to do the release today or tomorrow.

@liamwh
Copy link
Author

liamwh commented Sep 6, 2024

Super fast, awesome stuff, thanks very much 🙏! I dropped another issue here btw that might be good for the next release also?

@jeremychone jeremychone added the FIXED Issue was fixed or implemented, and will be in the next release. label Sep 6, 2024
@jeremychone jeremychone changed the title Error type printer Error type Sep 6, 2024
@jeremychone
Copy link
Owner

@liamwh release made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FIXED Issue was fixed or implemented, and will be in the next release.
Projects
None yet
Development

No branches or pull requests

2 participants