Code Monkey home page Code Monkey logo

Comments (3)

TehShrike avatar TehShrike commented on June 14, 2024

Yeah, it's really confusing what the difference between them is, and worse, I don't think the tests do a good job of asserting that they do the things specific to them (why is it a stateError and not a stateChangeError to navigate to a nonexistent state?).

A couple things:

  1. is there any real distinction to be found?
    1. Is it notable that some error events only happen between state changes starting and ending? I think that might be the current logic. Maybe this could be indicated by just a boolean between state changes.
    2. how significant is the difference between an error happening in a user-land function (like the provided activate function, or event handlers) and some other error happening (not able to turn a state name into a route when go is called or not being able to find a matching state when evaluateCurrentRoute is called)
  2. are any of these state routing issues serious enough to emit actual error events?

from abstract-state-router.

TehShrike avatar TehShrike commented on June 14, 2024

current stateError events:

handleError('stateError', err)
- I think this would only happen if a stateChangeAttempt listener threw an error. This should probably just be thrown in another tick instead of being emitted as a state-router error.

Same for

handleError('stateError', e)
which is just catching possible errors in event listener code.

For

handleError('stateError', err)
in evaluateCurrentRoute, the only place I see that could be causing that error would be if prototypalStateHolder.guaranteeAllStatesExist threw, which means that someone tried to navigate to a state that doesn't exist.

Maybe that should just throw straight out as well? It seems like a different kind of "not found" than the traditional one I'd imagine existing, which would be "there was no matching route for the url in the location bar".

from abstract-state-router.

ArtskydJ avatar ArtskydJ commented on June 14, 2024

I would expect to be directed to the hashBrownRouter.setDefault (404) state if the state doesn't exist.

If there wasn't a hash, I would expect to go to the fallbackState.

If I call state.go('this.route.does.not.exist'), I would expect to have an error thrown.

from abstract-state-router.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.