uploader send() - catch connection error

edited July 2019 in Technical questions

Hi, Webix team.
I catch connection error for ajax requests like this:
webix.attachEvent("onAjaxError", function(xhr){
if(xhr.status===0){
webix.message({type: 'error', text:"Ошибка соединения. Проверьте подключение к интернету"});
}
It isn't work with upload files by uploader send() method.
Callback run if response {"status":"server"}.
onAjaxError event isn't catch connect error.
onFileUploadError too.
Thank you in advance

Comments

  • Hey @valk20, onFileUploadError should be able to handle such a case just fine, please take a look at this example: https://snippet.webix.com/jje9fyf5. I'm not really sure why onFileUploadError didn't work out for you, could you perhaps share a snippet with your code so I could reproduce the issue?

  • If I lose internet connection I have OPTIONS https://docs.webix.com/samples/server/upl net::ERR_NAME_NOT_RESOLVED
    onFileUploadError not run

  • uploader send files asynchronic?

  • If I send multiple files and some of them have {"status":"error"}.
    send() callback isn't run?
    onFileUploadError run one time or for each file upload error?
    Sorry for many questions.

  • Perhaps you could do something like this to handle network connection errors: https://snippet.webix.com/0vi5s2g0 (replace xhttp.open() link to wherever you're uploading/storing data).

    uploader send files asynchronic?
    

    As far as I know send() is async.

    onFileUploadError run one time or for each file upload error?
    

    The event runs for every file that had an error.

  • ok. Thanks
    For example,
    If i upload 3 file.
    Upload complete and two files have {"status":"server"} and one of them {"status":"error"}.
    In this case
    "onFileUploadError" run for error upload file and then run send() callback?

    If all 3 files have {"status":"error"} send() callback isn't run and "onFileUploadError"run 3 times?

    Do I understand correctly?

  • Thanks, I check this question

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion