continue to output stderr for pyunittest because it shows unit test count
return error message as json when the accept header is json