openspending / openspending

The project aims to build and use open source tools and datasets to gather and analyse the financial transactions of governments around the world.
https://openspending.org/
GNU Affero General Public License v3.0
164 stars 57 forks source link

OS Viewer says "No data to display" when there was an error #1402

Closed jbothma closed 5 years ago

jbothma commented 6 years ago

I suggest you show a message like "Something went wrong" and if possible what they can do to rectify or investigate.

I tend to think a non-scary notice that something went wrong is more useful to users than making it appear like everything's ok but for some puzzling reason you don't get the expected outcome.

In this case there was a server error because of another issue which I'll raise in a separate bug. openspending-viewer-hidden-error

nightsh commented 5 years ago

The flow as I see it:

Now, if that is correct, I am missing a few bits:

At the moment I don't see how the messages in babbage-ui could be extended to include the error payload, probably parsed. It's annoying, as I can see them being used throughout the code, however my attempts to extend them were not successful.

I feel like I'm spiraling and in the need of help.

nightsh commented 5 years ago

Development so far:

All the components have to catch that error and emit it further. They don't work the same way, but ultimately they all end up doing some basic promise chains. The suggested implementation adds a new flag and conditionally sets the error message within the scope of their directives so it can be shown in templates.

The tricky part was following up on the promise chain, and throwing in the right places to help the server error reach the template.

nightsh commented 5 years ago

Corresponding PRs sent: