return error json instead of raising exception