proxy: return JSON errors

Fix #1630
agreed. added.