-
Notifications
You must be signed in to change notification settings - Fork 1
Custom Error Support for LoomError #12
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
Custom Error Support for LoomError #12
Conversation
Llm
trait
Llm
traitThere 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.
The approach you took does not allow the user to specify his own custom error type and have it propagated within the weave
function in a type safe way. The Llm
trait functions still return dyn Error
and therefore any error can be returned from the user, so there is no guarantee that the result of the weave
function would yield the error they expected.
I have updated the issue #11 to describe more deeply the requirements that should be met.
close #12 |
Overview
Improve error handling by providing more type-safe and flexible error management for users of the library.
Changes
Modified
LoomError
enumLlm
that uses the associated typePromptError
from theLlm
trait.Added
PromptError
associated type toLlm
trait:PromptError
in theLlm
trait.Error
trait.Updated
Result
type alias:Result
type alias to useLoomError<U>
as the error type.Usage Example
Users can now define their custom
PromptError
types and use them with the library:Error Handling
The new error structure allows for more precise error handling:
Benefits
Supplemental