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

I need help dealing with errors! #15

Open
rossanodr opened this issue Dec 2, 2024 · 0 comments
Open

I need help dealing with errors! #15

rossanodr opened this issue Dec 2, 2024 · 0 comments

Comments

@rossanodr
Copy link

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?

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

No branches or pull requests

1 participant