Change API to return error response in requested format
Change API to return error response in requested format

Change API to catch Exception instead of ApiException so it can also
return a response in those cases (instead of closing the connection
abruptly).
Change to check what kind of exception and type in case of ApiException
is begin caught to log the error with a more appropriate level (error vs
warn). In case of ApiException with type INTERNAL_ERROR it's not logged
anything, as those exceptions were already handled by ApiImplementors
which should have logged the exception/issue.
When the requested format is OTHER it's not generated any response, the
exceptions should be explicitly handled by the ApiImplementor because
the format is not known (so no suitable response can be generated).
Prepare the API to return different status code for client/server
errors.
Default to HTML format if the format is not known (BAD_FORMAT).
Fix #1805 - ZAP API might not return the response in requested format on
errors

ozzyjohnson/zaproxy,thc202/zaproxy,mabdi/zaproxy,MD14/zaproxy,Ye-Yong-Chi/zaproxy,0xkasun/zaproxy,gmaran23/zaproxy,mabdi/zaproxy,kingthorin/zaproxy,thc202/zaproxy,zapbot/zaproxy,thamizarasu/zaproxy,MD14/zaproxy,NVolcz/zaproxy,ozzyjohnson/zaproxy,Ali-Razmjoo/zaproxy,meitar/zaproxy,meitar/zaproxy,MD14/zaproxy,pdehaan/zaproxy,cassiodeveloper/zaproxy,thamizarasu/zaproxy,pdehaan/zaproxy,surikato/zaproxy,urgupluoglu/zaproxy,gmaran23/zaproxy,Ali-Razmjoo/zaproxy,Harinus/zaproxy,mustafa421/zaproxy,ozzyjohnson/zaproxy,mustafa421/zaproxy,cassiodeveloper/zaproxy,psiinon/zaproxy,gsavastano/zaproxy,meitar/zaproxy,MD14/zaproxy,NVolcz/zaproxy,zapbot/zaproxy,zapbot/zaproxy,mustafa421/zaproxy,kingthorin/zaproxy,pdehaan/zaproxy,thc202/zaproxy,MD14/zaproxy,JordanGS/zaproxy,Harinus/zaproxy,UjuE/zaproxy,pdehaan/zaproxy,lightsey/zaproxy,mustafa421/zaproxy,zaproxy/zaproxy,NVolcz/zaproxy,kingthorin/zaproxy,urgupluoglu/zaproxy,thc202/zaproxy,pdehaan/zaproxy,UjuE/zaproxy,mabdi/zaproxy,kingthorin/zaproxy,NVolcz/zaproxy,profjrr/zaproxy,cassiodeveloper/zaproxy,rajiv65/zaproxy,mabdi/zaproxy,0xkasun/zaproxy,gsavastano/zaproxy,tjackiw/zaproxy,ozzyjohnson/zaproxy,Ye-Yong-Chi/zaproxy,jorik041/zaproxy,tjackiw/zaproxy,JordanGS/zaproxy,0xkasun/zaproxy,0xkasun/zaproxy,tjackiw/zaproxy,JordanGS/zaproxy,profjrr/zaproxy,rajiv65/zaproxy,zaproxy/zaproxy,ozzyjohnson/zaproxy,jorik041/zaproxy,kingthorin/zaproxy,surikato/zaproxy,pdehaan/zaproxy,rajiv65/zaproxy,meitar/zaproxy,surikato/zaproxy,zaproxy/zaproxy,Ali-Razmjoo/zaproxy,profjrr/zaproxy,gmaran23/zaproxy,0xkasun/zaproxy,surikato/zaproxy,NVolcz/zaproxy,urgupluoglu/zaproxy,ozzyjohnson/zaproxy,rajiv65/zaproxy,Harinus/zaproxy,thamizarasu/zaproxy,UjuE/zaproxy,mustafa421/zaproxy,thamizarasu/zaproxy,gsavastano/zaproxy,thamizarasu/zaproxy,lightsey/zaproxy,psiinon/zaproxy,meitar/zaproxy,Ye-Yong-Chi/zaproxy,profjrr/zaproxy,lightsey/zaproxy,zapbot/zaproxy,Ali-Razmjoo/zaproxy,lightsey/zaproxy,surikato/zaproxy,lightsey/zaproxy,cassiodeveloper/zaproxy,zaproxy/zaproxy,UjuE/zaproxy,gsavastano/zaproxy,zapbot/zaproxy,thc202/zaproxy,UjuE/zaproxy,Ali-Razmjoo/zaproxy,profjrr/zaproxy,cassiodeveloper/zaproxy,Ye-Yong-Chi/zaproxy,cassiodeveloper/zaproxy,profjrr/zaproxy,mabdi/zaproxy,kingthorin/zaproxy,meitar/zaproxy,zaproxy/zaproxy,zaproxy/zaproxy,psiinon/zaproxy,JordanGS/zaproxy,urgupluoglu/zaproxy,zapbot/zaproxy,0xkasun/zaproxy,kingthorin/zaproxy,zapbot/zaproxy,jorik041/zaproxy,tjackiw/zaproxy,UjuE/zaproxy,JordanGS/zaproxy,surikato/zaproxy,psiinon/zaproxy,gmaran23/zaproxy,tjackiw/zaproxy,JordanGS/zaproxy,zaproxy/zaproxy,jorik041/zaproxy,UjuE/zaproxy,Ali-Razmjoo/zaproxy,Ye-Yong-Chi/zaproxy,gmaran23/zaproxy,rajiv65/zaproxy,jorik041/zaproxy,urgupluoglu/zaproxy,MD14/zaproxy,thamizarasu/zaproxy,mustafa421/zaproxy,psiinon/zaproxy,gsavastano/zaproxy,psiinon/zaproxy,gmaran23/zaproxy,Ali-Razmjoo/zaproxy,cassiodeveloper/zaproxy,thamizarasu/zaproxy,lightsey/zaproxy,mabdi/zaproxy,gmaran23/zaproxy,meitar/zaproxy,0xkasun/zaproxy,pdehaan/zaproxy,meitar/zaproxy,jorik041/zaproxy,Harinus/zaproxy,gsavastano/zaproxy,urgupluoglu/zaproxy,tjackiw/zaproxy,surikato/zaproxy,Harinus/zaproxy,JordanGS/zaproxy,Harinus/zaproxy,rajiv65/zaproxy,mustafa421/zaproxy,Harinus/zaproxy,profjrr/zaproxy,tjackiw/zaproxy,NVolcz/zaproxy,gsavastano/zaproxy,rajiv65/zaproxy,psiinon/zaproxy,thc202/zaproxy,urgupluoglu/zaproxy,lightsey/zaproxy,MD14/zaproxy,NVolcz/zaproxy,Ye-Yong-Chi/zaproxy,thc202/zaproxy,jorik041/zaproxy,ozzyjohnson/zaproxy,mabdi/zaproxy,Ye-Yong-Chi/zaproxy