okfn / opendataeditor

No-code application to explore and publish all kinds of data: datasets, tables, charts, maps, stories, and more. Forever free and open source project powered by open standards and generative AI.
http://opendataeditor.okfn.org
MIT License
149 stars 18 forks source link

Initial error handling implementation #431

Closed roll closed 1 week ago

roll commented 1 week ago

In this PR we start catching all the possible server errors and reflect them in the UI (exact UI can be updated later). Currently, error handling in actions is quite verbose but can be improved in #430 (using some kind of error boundaries in actions). Also, this iteration doesn't fully cover nested action errors (still can get into an inconsistent state), which also needs to be addressed in #430.

Other follow-up issues:

cloudflare-pages[bot] commented 1 week ago

Deploying opendataeditor with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2bdd46e
Status: ✅  Deploy successful!
Preview URL: https://0f633640.opendataeditor.pages.dev
Branch Preview URL: https://295-error-handling.opendataeditor.pages.dev

View logs

roll commented 1 week ago

@pdelboca Thanks!

Looks good @roll ! It reminds me a lot to go pattern:

Yea, exactly. Still not sure if it's the best one as it's great without nesting but if you have nested actions (e.g. doSomethign -> loadFields -> client.load) you need to have signature on the actions as well. I'll investigate further

Note: Is is truly necessary to repeat all the Error.tsx components?

I think it will be eliminated in https://github.com/okfn/opendataeditor/issues/430; it will have an error state only in one store so the error component will be global as well