1 (edited by filmotheklown 2018-08-22 20:56:58)

Topic: Error Handling - passing error msgs from server to client

I'm unclear on the methods and callbacks that should be used to handle errors on the Server side (specifically with regards to chunking) that can get passed back to the Client side javascript.

For example, if I want to throw an error from the server back to the client, what is the JSON format that should be used.

In some places of the demo code I see some basic response like {"OK":1} or {"OK":0,"Error":msg} in other areas I see:


die('{"jsonrpc" : "2.0", "error" : {"code": 104, "message": "File size does not match."}, "id" : "id"}');


Clearly these are two very different JSON packets to send back to the client side.

On the client side, what call back is used to catch errors from the server side? I assumed there would be some sort of built in error message handler within the Uploader object, but the best I can find is to parse the JSON response manually in the 'ChunkUploaded' call back ???