Opened 14 years ago

Last modified 5 years ago

#6765 assigned enhancement

JSON Procedure Call: error handling

Reported by: guest Owned by: Kris Zyp
Priority: low Milestone: 1.15
Component: RPC Version: 1.1.0
Keywords: RPC, JSON, error, exception needsreview Cc: alex
Blocked By: Blocking:


Error object contains only HTTP error. Example:

       var myObject = new dojo.rpc.JsonService("/definition.smd");
       var myDeferred = myObject.add(121,5});

Exception thrown deliberately in PHP file (token is not defined).

if (
!== Request::get()->getRpcParams('token')
) :
throw new Exception('RPC Server: Invalid token', 3006);


  message : Unable to load /rpcServer.php status:400
  fileName :
  lineNumber : 475
  stack : Error("Unable to load /rpcServer.php status:400")@:0
([object Error])@
([object Error])@
([object Error])@
([object Object])@

  name : Error

Expected: Have access to exception data including optional field data as specified in JSON-RPC over HTTP.

 responseText : {"result":null,"error":{"code":-32600,"message":"Invailid request.","data":"RPC Server: Invalid token"},"id":null}

Resolution: In RpcService?.js on line 83 entire object data should be passed and not only property message congaing only HTTP message. Current code:

deferredRequestHandler.errback(new Error(data.message));

Suggested change:

deferredRequestHandler.errback(new Error(data));

In this manner developer would have chance to fine tune error handling.

Change History (9)

comment:1 Changed 14 years ago by guest

Actually since in every case data is already error object line new error object should not be created. Line 86 should read:


comment:2 Changed 14 years ago by bill

Milestone: tbd

mark all (open) tickets w/blank milestones to be "tbd"; their milestones need to be set to a version number or to "future"

comment:3 Changed 13 years ago by Kris Zyp

Resolution: fixed
Status: newclosed

(In [14792]) fixes #6765

comment:4 Changed 13 years ago by dylan

Milestone: tbd1.2

comment:5 Changed 11 years ago by Jan Schatz

Resolution: fixed
Status: closedreopened

changeset:14792 didn't solve the problem, but made it worse. Now instead of passing the complete error object only the error message is passed to the errback. This is not compatible with previous version.

comment:6 Changed 10 years ago by ben hockey

Keywords: needsreview added
Owner: changed from Dustin Machi to Kris Zyp
Priority: highlow
Status: reopenedassigned

comment:7 Changed 10 years ago by bill

Milestone: 1.2tbd

comment:8 Changed 6 years ago by dylan

Milestone: tbd1.12

comment:9 Changed 5 years ago by dylan

Milestone: 1.131.15

Ticket planning... move current 1.13 tickets out to 1.15 to make it easier to move tickets into the 1.13 milestone.

Note: See TracTickets for help on using tickets.