Throw Errors instead of strings

Change-Id: Idac17d8cad97231b99d35569ae229dd85bae4a7c
Give useful JSON errors instead of crashing

Front end can now check for the error property of anything coming
back from data and metadata routes.

Change-Id: Ia0b2a5680bcb9fc9c5a796fd4db1feb290d80956