(error: any)
| 205 | } |
| 206 | |
| 207 | onError(error: any) { |
| 208 | const isStopping = this.status == "stopping"; |
| 209 | console.error("Upload error:", error); |
| 210 | if (!isStopping) { |
| 211 | this.retries += 1; |
| 212 | message.error( |
| 213 | t("TXT_CODE_6adffa20") + |
| 214 | (this.retries < 3 |
| 215 | ? t("TXT_CODE_31145b04", { |
| 216 | retries: this.retries + 1, |
| 217 | maxRetries: 3 |
| 218 | }) |
| 219 | : t("TXT_CODE_3f828072")) |
| 220 | ); |
| 221 | } |
| 222 | const msg = error.response?.data || error.message; |
| 223 | console.error(msg); |
| 224 | if (msg == "Access denied: No task found" || msg == "File is not opened") { |
| 225 | // usually caused by multi-tab upload, just remove the task |
| 226 | this.status = "removing"; |
| 227 | return uploadService.update(); |
| 228 | } |
| 229 | this.status = "failed"; |
| 230 | this.onProgress(0); |
| 231 | |
| 232 | if (!isStopping && this.retries < 3) { |
| 233 | this.start(); // async |
| 234 | } else { |
| 235 | uploadService.update(); |
| 236 | console.error( |
| 237 | "Max retries reached for file piece:", |
| 238 | this.file.file.name, |
| 239 | "Range:", |
| 240 | this.rangeStart, |
| 241 | "-", |
| 242 | this.rangeEnd |
| 243 | ); |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | onProgress(progress: number) { |
| 248 | this.progress = progress; |
no test coverage detected