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

[Feature] Navigation results #3

Open
BurkusCat opened this issue Oct 2, 2023 · 0 comments
Open

[Feature] Navigation results #3

BurkusCat opened this issue Oct 2, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@BurkusCat
Copy link
Owner

Is your feature request related to a problem? Please describe.
When navigating to a page, it doesn't always happen successfully. It would be good if the page/service performing the navigation, was able to handle the result.

Describe the solution you'd like
The navigation service methods could be updated to return Task<NavigationResult>. The result can be ignored if the caller wishes e.g.

await navigationService.Push(...);
_ = await navigationService.Push(...);

Does the first line in the example above generate any warnings in compiler?

Describe alternatives you've considered
Try/catches on calls to navigation service.

Proposed APIs
If possible, try to propose how the API might look. For example:

// NavigationResult
public bool IsSuccess { get; }

public Exception Exception { get; }

Additional context
It is probably a good idea to support two different styles of error handling. This new method is one of them, another way is allowing any failed navigation to throw exceptions instead of returning a result.

Builder configuration: ThrowOnNavigationFailure, instead of catching a navigation exception and returning a result, it should rethrow the exception

  • Default is false?
  • What would be the best default?
@BurkusCat BurkusCat added the enhancement New feature or request label Oct 2, 2023
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

No branches or pull requests

1 participant