-
Notifications
You must be signed in to change notification settings - Fork 14
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
closes #53 #54
closes #53 #54
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right direction, just concerned about exceptions during reveal().
*/ | ||
@Deprecated | ||
void revealInFileManager() throws CommandFailedException; | ||
void reveal(Consumer<Path> revealer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, if we should define our own FunctionalInterface for revealer
to allow throwing checked exceptions..? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The question is, does it yield a value for the adapter to know that there was a problem during reveal? From my point of view no, because the mount object does not care if it is "revealable" from an external resource (revealer
object). It even should only care about itself. If we enforce this caring by a checked exception, it would, from my point of view, only lead to a catch and rethrow.
On the other hand, the caller might know the revealer
object and thus can handle possible the fitting, occuring RuntimeExceptions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The call stack would be:
- gui.clickedRevealButton()
- mount.reveal(revealer)
- revealer.reveal(path)
An exception thrown by 3. is expected to bubble up to 1., so that we can handle the exception where the whole command was invoked. If we want a checked exception, it is required to be thrown during 3. by revealer
and not to be caught in 2. by mount
.
For unchecked exceptions this is already taken care of, but the question is: Do we want the consumer of the API to be aware of the fact that this might fail? Imo, yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I second, that the API consumer should be informed of possible failure. Unfortunately, due to the inversion of control we have to wrap any exception occuring in Edit: i had a wrong understandingrevealer.reveal(path)
only to unwrap it in the gui layer again, but I guess we cannot have both.
I'll change the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes made in 2a4cc57.
The reveal() methods accepts now objects of types Revealer
and throws RevealExceptions
src/main/java/org/cryptomator/frontend/fuse/mount/AwtFrameworkRevealer.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Sebastian Stenzel <[email protected]>
* Add new Revealer and Reveal exception classes * method accepts Revealer and throws RevealException
src/main/java/org/cryptomator/frontend/fuse/mount/RevealException.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost good 😉
additionally to the refactoring the class AwtFrameworkRevealer is added, which gives library users a default revealer at hand.