last day (15 days later) » 

5:53 PM
0
Q: fine uploader delete custom error message not coming back

Norbert NorbertsonI am having trouble getting a custom error message back from my file delete handler. I am not sure but it looks like the delete is handled differently to the upload. From the docs: You may return any response you like, as the XMLHttpRequest object will be >passed to your onDeleteComplete han...

 
The "handler" you posted doesn't look anything like JavaScript. Please include your actual onDeleteComplete handler in your question.
 
I've added the OnError javascript. But your comment leads me to realise the issue is likely to be that I should be handling the error in the onDeleteComplete and not the onError call back. It seemed logical that onError would be getting called and that onDeleteComplete would only be called on delete success. I guess not?
 
As the documentation states, the onDeleteComplete callback will be called when the delete operation completes. If it was strictly called on success, it would be called onDeleteSuccess. This behavior is consistent with the rest of the API, such as the onComplete callback.
 
ok, thanks. Makes complete sense now of course.
Although, reading this part of the docs: error handling. I don't feel It's apparent how delete errors should be handled. I fell right into the trap of thinking 'onError' would catch the delete error custom message. Perhaps a note on handling delete errors in that section would have helped?
 
If I could do this over again, I would have never created an onError callback. I would suggest using that only for logging, and contributing a handler for a specific callback to track and react to any specific errors.
 
5:53 PM
I have updated my question again. I just can't get it to do what I want. Either my json response is wrong (I can't see why) for the failed delete or FineUploader does not work as expected.
 
I'm not seeing anything in your onDeleteComplete handler that is attempting to read the response from the XMLHttpRequest object.
 
ok, now we're getting somewhere. If I do this:
console.log("resp text=" + xhr.responseText);
I get this:
resp text={"success":false,"error":"THIS IS THE ERROR"}
in the console
So I can use that.
 
6:08 PM
It works in either onError or onDeleteComplete. So I will go with onError for now because it seems more logical to me. But I have to say I feel this does not work as stated in the docs: "By default, if Fine Uploader does not receive a successful server response, it will look for the error property of the response body and will pass that value to the onError callback."
If by "error" property you mean the json string in the response {"Error":"This is the error"} then FineUploader should be using that value in the onError callback as state above.
So I feel I am somewhat justified in struggling with this.
 

  last day (15 days later) »