-
Notifications
You must be signed in to change notification settings - Fork 99
I need help dealing with errors! #15
Copy link
Copy link
Open
Description
What is the correct way to handle errors in the front end of this project?
I have some doubts about this because the StreamEvent in eventHandlerOne doesn't have typings for errors.
const eventHandlerOne = (
streamEvent: StreamEvent,
fields: EventHandlerFields
) => {
try {
const langGraphEvent: StreamEvent = streamEvent.data.chunk;
console.log("langGraphEvent", langGraphEvent.error);
if (!langGraphEvent) {
return;
}
const { event, name, data } = langGraphEvent;
if (event !== "on_chain_end") {
return;
}
} catch (error) {
console.log("error", error);
}
};
In the example above, when I force an error, I get the result langGraphEvent Error
error TypeError: Cannot read properties of undefined (reading 'error').
However, the code presents typing errors:
Property 'error' does not exist on type 'StreamEvent'.ts(2339)
What is the ideal way to handle errors in langGraph cloud projects?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels