conveyal / analysis-backend

Server component of Conveyal Analysis
http://conveyal.com/analysis
MIT License
23 stars 12 forks source link

Better error handling and validation in OpportunityDatasetController #260

Closed abyrd closed 4 years ago

abyrd commented 4 years ago

This PR fixes #259. As discussed earlier, when possible we want to return a valid status to the UI instead of blowing up with an exception. This tries to set the status to ERROR with a clear message whenever we can, including input validation failures.

While I was at it I added some convenience methods to the status object for marking it completed with error or success, and implemented a few other validation suggestions present in code comments.

The specific problem that prompted this work (CSV upload with no numeric columns) should now be detected early and propagate a clear error message to the UI in controlled, persistent form as an upload status object.