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

Add TemplateNotFoundError #45

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

thatnerdjosh
Copy link

@thatnerdjosh thatnerdjosh commented May 22, 2024

Context: When loading a prompt from Lunary, it would output an error without letting me know which template it is. I saw there was an Exception raised, it was just being contained within the library. This allows the user to do as they wish with error handling.

Feel free to adjust as necessary - re-raising in every scenario probably isn't ideal - I kept the scope of the changes to the __init__.py and limited to what seemed to be public interface.

  1. Adds TemplateNotFoundError.
  2. Re-raises errors to allow the client to handle them.
  3. Uses logger across the board.
  4. Adds .editorconfig for formatting.

@thatnerdjosh
Copy link
Author

@hughcrt - for review :)

@thatnerdjosh thatnerdjosh changed the title Improve error handling Add TemplateNotFoundError May 22, 2024
@thatnerdjosh
Copy link
Author

@hughcrt - note - this PR is made with the intention on being able to act on (from the end user side) error conditions in Lunary.

When reviewing, please consider this. It's less about re-raising, or specific implementation details, and more about the ability to act on error conditions directly rather than side effects thereof.

@thatnerdjosh
Copy link
Author

Closing

@hughcrt hughcrt reopened this Jun 5, 2024
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

Successfully merging this pull request may close these issues.

2 participants