-
Notifications
You must be signed in to change notification settings - Fork 151
Handle Jinja error messages #292
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
Handle Jinja error messages #292
Conversation
3b0fb2f to
ca0e333
Compare
|
Thank you for your contributions to this package and swift-jinja. I agree with your changes here. @pcuenca Does this look good to you? Or do you have any suggestions for how to surface these errors differently? |
|
We could potentially use a different error, but this works for me if it works for @DePasqualeOrg! |
This reverts commit 6fdfa9e.
|
@pcuenca, @mattt, this can be reverted, since I verified that the error is handled correctly here: https://github.com/DePasqualeOrg/swift-transformers/tree/revert-jinja-error-handling I think that while I was testing the error propagation with changes in swift-transformers and swift-jinja, something went wrong and the error was not handled as expected, which led me to conclude that we need to handle |
|
@DePasqualeOrg not a fan of touching history unless necessary, but will merge #293 as you prefer it, (and the code is a bit easier). I cherry-picked the commit from your repo to correctly attribute the fix. I'll also create a release with the latest commits. |
|
Thank you. It's not a matter of preference, but of correctness. The check is not necessary, so we should remove it. |
I'm trying to surface error messages from Jinja so that consuming apps can show them in the UI. Currently they're thrown as a
JinjaError, which means consuming apps would have to check for that error type in order to show the error message. Here I'm checking forJinjaErrorinapplyChatTemplateand wrapping the error message inTokenizerError.chatTemplate. I'm not sure if this is the best solution, but it does expose the error message from Jinja in my app.See huggingface/swift-jinja#39