Closed micho closed 11 years ago
That would be a really good addition, what would be the desired default behavior when an upload fails? Just remove the inserted "![]()" which would be confusing because it does not give the user any good feedback. Or let the programmer return an error message in the resulting server response inside a JSON "error" key which then would be inserted in place of the image link, and remove after a timeout?
I would like to have the option to return a 500 code which results in a default error message (also configurable?) or an error value which can be returned by the server.
In my current implementation, it displays an alert("Upload failed, check your connectivity") and removes the text. This message is customizable via settings.errorText. We could add different error messages for server error or AJAX timeout error.
A programmer could supply their own callback, but this makes me wonder about the more general idea of handling custom callbacks.
The custom callback could return false to prevent the default behavior from executing, this would be the most simplest way to override the behavior while giving the choice to run default behavior when false is not returned.
@micho Could you PR your current implementation?
Uploaded code here:
I'm considering adding an error callback to react if the file wasn't uploaded correctly.
I believe this should be overridable. Do you have any ideas about this, or would you like me to send a PR with it?