oz icon indicating copy to clipboard operation
oz copied to clipboard

Router should throw a different error when page hasn't changed at all

Open PanoramicPanda opened this issue 6 years ago • 1 comments

Router currently throws RuntimeError: ERROR: The Application is on the wrong page! OZ expected that page to be [Page_Y] but found [Page_X]! whenever it lands on the improper page.

While still technically a routing issue, a more verbose/different error should likely be thrown when Page_X is the same page you just tried to leave.

PanoramicPanda avatar Feb 06 '19 15:02 PanoramicPanda

Uriah and I were discussing a few things about this.

Essentially a more indepth case is the page doesn't do anything to tell you WHY it failed to navigate away from itself.

One of the lowest hanging fruits would be checking if fields were empty. Potential solutions we discussed:

  • Add an optional flag to fields, required: true, that makes the page tell you if this field was empty if the error is hit.

    • Pros:
      • Declarative
    • Cons:
      • Bloats element creation hashes for something that's essentially a "Did i screw up check"
  • Just dump all empty or default value'd fields alongside the error message if they were enabled.

    • Pros
      • Doesn't require any rework on page classes
    • Cons
      • Clogs logs further
      • Doesn't tell you if a field was mandatory so you'd still have to check which fields were mandatory

Castone22 avatar Jul 12 '19 18:07 Castone22