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

routeResolver.onmatch swallows errors #2531

Open
sjmik opened this issue Sep 19, 2019 · 2 comments
Open

routeResolver.onmatch swallows errors #2531

sjmik opened this issue Sep 19, 2019 · 2 comments
Assignees
Labels
Area: Core For anything dealing with Mithril core itself Type: Bug For bugs and any other unexpected breakage

Comments

@sjmik
Copy link

sjmik commented Sep 19, 2019

Mithril version: 2.0.3

Browser and OS: Chrome 76 on Win 10

Code

Flems

m.route(document.body, '/', {
  '/': {
    render() { return m('h3', 'Home page'); }
  },
  '/other': {
    onmatch() { p('do something crazy'); x.y; p('done?'); },
    render() { return m('h3', 'Other page'); }
  }
});
m.route.set('other');

Steps to Reproduce

  1. Run the code.
  2. Look at the JS console.

Expected Behavior

Not sure what behavior should happen, but I do expect to see the error in the JS console.

Current Behavior

Routed to default route and no error is shown in the JS console.

Context

Makes it difficult to debug why an application is behaving in an unexpected way when you can't see the underlying error.

@sjmik sjmik added the Type: Bug For bugs and any other unexpected breakage label Sep 19, 2019
@dead-claudia
Copy link
Member

Pretty sure this is somewhat intentional, but not entirely. What it could do is rethrow the error on rejection, so it acts more properly like a finally.

@dead-claudia
Copy link
Member

I didn't design that part of the router, BTW. So I'm not sure what the rationale was, if it was in fact by design. I don't believe this part is tested for, so it might have been an oversight.

@dead-claudia dead-claudia moved this to Low priority in Triage/bugs Sep 2, 2024
@dead-claudia dead-claudia added the Area: Core For anything dealing with Mithril core itself label Sep 2, 2024
@dead-claudia dead-claudia mentioned this issue Oct 13, 2024
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Core For anything dealing with Mithril core itself Type: Bug For bugs and any other unexpected breakage
Projects
Status: Low priority
Development

No branches or pull requests

3 participants