Opened 13 years ago

Closed 12 years ago

#2237 closed enhancement (fixed)

RpcService.js can't receive error objects

Reported by: ndwolf@… Owned by: dylan
Priority: high Milestone: 0.9
Component: RPC Version: 0.4.1
Keywords: json rpc Cc:
Blocked By: Blocking:

Description

according to json-rpc.org specifications error must be an object, but dojo just allows strings. it will be great if this can be solved in next verions, the patch is very simple. I've made it myself to run my applications right.

Change History (3)

comment:1 Changed 13 years ago by ndwolf@…

this is the code from RpcService?.js:

if (objerror?!=null) {

if(typeof obj.error == 'object'){

var err = new Error(obj.error.message); err.code = obj.error.code; err.error = obj.error.error;

} else {

var err = new Error(obj.error);

}

so you still have the string text error with obj.error.message to send in new Error and can accept the object error with message, code, and custom error object with extra data. This standarization comes from json-rpc.org specifications draft 1.1 and I think its ok.

comment:2 Changed 13 years ago by dylan

Milestone: 0.9
Owner: changed from Dustin Machi to dylan
Status: newassigned

comment:3 Changed 12 years ago by dylan

Resolution: fixed
Status: assignedclosed

(In [9872]) fixes #2237, handle case for RPCService where an error object should be returned instead of a string

Note: See TracTickets for help on using tickets.