diff --git a/src/question_file.ts b/src/question_file.ts index 2045fe2c4f..7e72e5e4ac 100644 --- a/src/question_file.ts +++ b/src/question_file.ts @@ -622,7 +622,9 @@ export class QuestionFileModel extends Question { if (this.survey) { this.survey.uploadFiles(this, this.name, files, (status, data) => { if (status === "error") { + this.errors.push(new UploadingFileError(data, this)); this.stateChanged("error"); + this.stateChanged("loaded"); } if (status === "success") { this.value = (this.value || []).concat( diff --git a/tests/questionFileTests.ts b/tests/questionFileTests.ts index 8747ee4a18..61d1392372 100644 --- a/tests/questionFileTests.ts +++ b/tests/questionFileTests.ts @@ -481,7 +481,7 @@ QUnit.test( }) ); } else { - options.callback("error"); + options.callback("error", "custom error text"); } }, 1); }); @@ -504,8 +504,10 @@ QUnit.test( setTimeout(() => { assert.ok(q1.isEmpty()); assert.equal(q1.value, undefined); - assert.equal(stateSec, "->loading->error"); - assert.equal(state, "error"); + assert.equal(stateSec, "->loading->error->loaded"); + assert.equal(q1.errors.length, 1, "Has errors"); + assert.equal(q1.errors[0].text, "custom error text", "Error text"); + assert.equal(state, "loaded"); done(); isSuccess = true;