Page MenuHomePhabricator

[native] Introduce simple error handling

Authored by tomek on May 19 2023, 10:16 AM.
Referenced Files
Unknown Object (File)
Aug 24 2023, 12:32 AM
Unknown Object (File)
Aug 23 2023, 9:41 PM
Unknown Object (File)
Jun 3 2023, 11:00 PM
Unknown Object (File)
Jun 3 2023, 10:05 PM
Unknown Object (File)
Jun 3 2023, 8:47 AM
Unknown Object (File)
May 29 2023, 7:53 PM
Unknown Object (File)
May 21 2023, 3:12 AM
Unknown Object (File)
May 19 2023, 10:50 AM



This is a simplified version of error handling, without useful error message. Created a task to track implementing the proper solution.

Depends on D7883

Test Plan

Check if creating a link with white char or one that is already in use results in an error.

Diff Detail

rCOMM Comm
Lint Not Applicable
Tests Not Applicable

Event Timeline

kamil added inline comments.
44 ↗(On Diff #26687)

I would prefer a less generic name to be more descriptive but up to you

53 ↗(On Diff #26687)

I don't where this error will be caught and how this will behave, but maybe logging an error message here is a good idea?

68–71 ↗(On Diff #26687)

You can use an empty string instead of null in the state (const [error, setError] = React.useState('');), and then render this component always and get rid of this logic, which is shorter and I think also cleaner

This revision is now accepted and ready to land.May 22 2023, 9:42 AM
44 ↗(On Diff #26687)

When there's just one action creator in this component, I think it is ok to be really generic - it's not confusing. Later, in D7908, I'm introducing another action creator and then this name changes to be more precise.

53 ↗(On Diff #26687)

There's no need for that. Throwing an error in async function passed to dispatchActionPromise results in appropriate _FAILED action being dispatched. Then the caller can decide how to handle that (using createLoadingStatusSelector).

68–71 ↗(On Diff #26687)

The difference is that it would then take vertical space, so it's better to not render the error in that case.

This revision was automatically updated to reflect the committed changes.