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

Apply new Result/TerriaError pattern to traits.fromJson() #5440

Merged
merged 5 commits into from
Apr 22, 2021

Conversation

nf-s
Copy link
Contributor

@nf-s nf-s commented Apr 21, 2021

Apply new Result/TerriaError pattern to traits.fromJson()

This depends on #5429

This makes some changes to how we handle errors update/upserting JSON into the model. If an error is occurred while updating a trait in a model (for example, a trait doesn't exist) it will not interrupt updating the model — it will just add an error message and continue.

Checklist

  • There are unit tests to verify my changes are correct or unit tests aren't applicable (if so, write quick reason why unit tests don't exist)
  • I've updated CHANGES.md with what I changed.

@nf-s nf-s mentioned this pull request Apr 21, 2021
2 tasks
@nf-s
Copy link
Contributor Author

nf-s commented Apr 21, 2021

Example error message (unformatted):

Error loading map configuration

An error occurred while loading NEII Viewer map configuration — it may not display correctly. Please try reloading the map, and if the problem persists, please report it by sending an email to environment@bom.gov.au, or you can press the button below.

Developer details
An error occurred while loading initialization information from:
V7 Init URL from config https://raw.githubusercontent.com/TerriaJS/neii-viewer/master/wwwroot/init/neii-oceans.json.

Error loading initialization source

Failed to add members from JSON for model /

Error occurred while updating modelReferenceArrayTrait model "/" from JSON

Error upserting model JSON: //NEII Data Services – Conformant

Error updating model from JSON: //NEII Data Services – Conformant

Error occurred while updating model //NEII Data Services – Conformant from JSON

Error occurred while updating modelReferenceArrayTrait model "//NEII Data Services – Conformant" from JSON

Error upserting model JSON: //NEII Data Services – Conformant/Oceans (14)

Error updating model from JSON: //NEII Data Services – Conformant/Oceans (14)

Error occurred while updating model //NEII Data Services – Conformant/Oceans (14) from JSON

Error occurred while updating modelReferenceArrayTrait model "//NEII Data Services – Conformant/Oceans (14)" from JSON

Error upserting model JSON: //NEII Data Services – Conformant/Oceans (14)/ NSW Marine protected areas (NSW DPI)

Error updating model from JSON: //NEII Data Services – Conformant/Oceans (14)/ NSW Marine protected areas (NSW DPI)

Error occurred while updating model //NEII Data Services – Conformant/Oceans (14)/ NSW Marine protected areas (NSW DPI) from JSON

The property rectangle is not valid for type wfs-group.

This is very verbose, quite a few errors could be dropped

@nf-s nf-s marked this pull request as ready for review April 22, 2021 04:28
@nf-s nf-s merged commit 5339ff9 into new-terria-error Apr 22, 2021
@nf-s nf-s deleted the error-handling-fromjson branch April 22, 2021 04:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant