a bit of cleanup
send 500s on internal errors to conform with JSONWP
tests of 500 server error behavior