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

Improve local shell CWD setting #4396

Merged
merged 4 commits into from
Nov 23, 2021
Merged

Conversation

Nokel81
Copy link
Collaborator

@Nokel81 Nokel81 commented Nov 19, 2021

Signed-off-by: Sebastian Malton [email protected]

Just some quality of life improvements.
Screen Shot 2021-11-19 at 4 10 19 PM
Screen Shot 2021-11-19 at 4 10 14 PM
Screen Shot 2021-11-19 at 4 10 10 PM

@Nokel81 Nokel81 added the enhancement New feature or request label Nov 19, 2021
@Nokel81 Nokel81 requested a review from a team as a code owner November 19, 2021 21:14
@Nokel81 Nokel81 requested review from jweak and jakolehm and removed request for a team November 19, 2021 21:14
Signed-off-by: Sebastian Malton <[email protected]>
<p>Provided path does not exist, your changes were not saved.</p>
</>,
);
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't suppress unknown exceptions here. It hides information, prevents centralized error handling and logging etc.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this suppressing unknown errors, do you mean I should handle each FS error code separately?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean that unknown exceptions are unknown for a reason. We should treat them as fatal exceptions which have to be fixed from our side.

So basically, separate fatal exceptions and non fatal exceptions from each other.

  • Fatal exception is something unexpected that we need to know about. User has no way to fix it.
  • Non fatal exception is something expected that we don't need to know about. User has to fix it, since it's part of the non-happy case scenario. In this case, e.g. providing path to directory that doesn't exist is "non fatal exception", since user can simply change the directory. (as you have done)

I can see that you have done changes to the logic handling exceptions, and it's getting better. Most important part for now, is that the unknown exceptions are reported somewhere so that we can start treating them as bugs to be fixed.

In the future, I think that we should start catching the fatal exceptions from top level and using throw as a mechanism since then we have most detailed error stack available when we are trying to fix the issue. But yeah, that's long in the future, since it would mean that we need to get rid of larger scope "try/catch"-usages.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot really treat them as fatal since the application should continue to be usable, I would prefer "expected exceptions" vs "unexpected exceptions" (which I know sounds like an oxymoron).

In this I don't really like the design of JS, and much prefer Rust's design, where errors are just data. It is slightly hard to do that in JS since the entire ecosystem uses throw

@jansav
Copy link
Contributor

jansav commented Nov 22, 2021

There are no unit tests. We (me and @Iku-turso) are eager to help in making this happen :)

Signed-off-by: Sebastian Malton <[email protected]>
@Nokel81
Copy link
Collaborator Author

Nokel81 commented Nov 22, 2021

@jansav I have added some basic unit tests.

@Nokel81 Nokel81 requested a review from jansav November 22, 2021 18:59
@jansav
Copy link
Contributor

jansav commented Nov 23, 2021

@jansav I have added some basic unit tests.

Great!

Copy link
Contributor

@jansav jansav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the big picture behind the improvements (e.g. why these changes are introduced?), so someone else should check it too.

Anyway, changes that I pointed out are done, so I'm happy.

@Nokel81
Copy link
Collaborator Author

Nokel81 commented Nov 23, 2021

I don't see the big picture behind the improvements (e.g. why these changes are introduced?), so someone else should check it too.

I goal of this code was two fold:

  1. Allow the user to use a folder picker for the path instead of having to type it out manually (and the clear button felt like a natural extension of that)
  2. Improve the handling of CWD settings for the local shell sessions so that users never get chdir errors.

@Nokel81 Nokel81 merged commit 7c5a0a9 into master Nov 23, 2021
@Nokel81 Nokel81 deleted the feat/improve-local-cwd-setting branch November 23, 2021 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants