marklogic-community / data-explorer

Data Explorer Tool
Other
15 stars 4 forks source link

Fix for showing an error message when no schemas database exists #199

Open cskeefer opened 4 years ago

cskeefer commented 4 years ago

For Issue #188

Displaying errors has been a pain point for a while and this is one way to go about a fix. Historically, data-explorer was more of a server-only app where the UI was generated on the server. Because of that, errors were created/returned in HTML via the error.xqy file and rendered directly in the browser. Some time ago, data-explorer was changed to be more client server where the client is written using angularJS. With this methodology, errors returned from REST calls that are a full HTML page weren't very useful. As such I changed error.xqy to convert the error stack to JSON and changed the content type to application/json. This will allow us to inspect the error from angularJS and display something more meaningful than "...an error occurred". It will also let us easily inspect the error in the Network tab of the browser dev tools.

I've only updated the call to create a query to inspect the JSON return and show a better message if there is no schemas database. The rest of the places where we display an error message should continue to work as is (with the vague msg), but we can change to show a more specific error in the future.

In doing this fix I have also assumed the requirement that a content database will have a schemas database associated with it. If this isn't a fair assumption, we'll have to do something else but it seems troublesome to support creating TDEs and not require a schemas database.

I also included changes to the build.gradle file so the artifacts are retrieved from repos using HTTPS and did an ml-gradle and ml-app-deployer bump to 3.17.0. These changes are also in PR #198 but I need them here as well so I could run ml-deploy to develop and test. Note this will likely require a JDK newer than 8 so you get the cert that allows HTTPS access to the repos.