Cakephp default error response but i need to json format error response

Do you want the error message always in JSON, or always in XML, or sometimes in one but sometimes the other? If “sometimes”, what would be the deciding factor in which to use?