diff options
author | Chocobozzz <me@florianbigard.com> | 2018-11-16 10:05:25 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-11-16 10:05:25 +0100 |
commit | 7373507fa830b0f18cb4cd95dfd923b1600e501d (patch) | |
tree | 112fc5b4bc0cabd599a39452962cefb9733f97ec /client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts | |
parent | fe05c3acbd48c72ac7e503bebde91830121a0bf1 (diff) | |
download | PeerTube-7373507fa830b0f18cb4cd95dfd923b1600e501d.tar.gz PeerTube-7373507fa830b0f18cb4cd95dfd923b1600e501d.tar.zst PeerTube-7373507fa830b0f18cb4cd95dfd923b1600e501d.zip |
Improve video upload error handling
Diffstat (limited to 'client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts')
-rw-r--r-- | client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts index e13c06ce9..13776ae36 100644 --- a/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts +++ b/client/src/app/videos/+video-edit/video-add-components/video-import-torrent.component.ts | |||
@@ -12,6 +12,7 @@ import { VideoEdit } from '@app/shared/video/video-edit.model' | |||
12 | import { FormValidatorService } from '@app/shared' | 12 | import { FormValidatorService } from '@app/shared' |
13 | import { VideoCaptionService } from '@app/shared/video-caption' | 13 | import { VideoCaptionService } from '@app/shared/video-caption' |
14 | import { VideoImportService } from '@app/shared/video-import' | 14 | import { VideoImportService } from '@app/shared/video-import' |
15 | import { scrollToTop } from '@app/shared/misc/utils' | ||
15 | 16 | ||
16 | @Component({ | 17 | @Component({ |
17 | selector: 'my-video-import-torrent', | 18 | selector: 'my-video-import-torrent', |
@@ -23,9 +24,9 @@ import { VideoImportService } from '@app/shared/video-import' | |||
23 | }) | 24 | }) |
24 | export class VideoImportTorrentComponent extends VideoSend implements OnInit, CanComponentDeactivate { | 25 | export class VideoImportTorrentComponent extends VideoSend implements OnInit, CanComponentDeactivate { |
25 | @Output() firstStepDone = new EventEmitter<string>() | 26 | @Output() firstStepDone = new EventEmitter<string>() |
27 | @Output() firstStepError = new EventEmitter<void>() | ||
26 | @ViewChild('torrentfileInput') torrentfileInput: ElementRef<HTMLInputElement> | 28 | @ViewChild('torrentfileInput') torrentfileInput: ElementRef<HTMLInputElement> |
27 | 29 | ||
28 | videoFileName: string | ||
29 | magnetUri = '' | 30 | magnetUri = '' |
30 | 31 | ||
31 | isImportingVideo = false | 32 | isImportingVideo = false |
@@ -33,6 +34,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca | |||
33 | isUpdatingVideo = false | 34 | isUpdatingVideo = false |
34 | 35 | ||
35 | video: VideoEdit | 36 | video: VideoEdit |
37 | error: string | ||
36 | 38 | ||
37 | protected readonly DEFAULT_VIDEO_PRIVACY = VideoPrivacy.PUBLIC | 39 | protected readonly DEFAULT_VIDEO_PRIVACY = VideoPrivacy.PUBLIC |
38 | 40 | ||
@@ -104,6 +106,7 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca | |||
104 | err => { | 106 | err => { |
105 | this.loadingBar.complete() | 107 | this.loadingBar.complete() |
106 | this.isImportingVideo = false | 108 | this.isImportingVideo = false |
109 | this.firstStepError.emit() | ||
107 | this.notificationsService.error(this.i18n('Error'), err.message) | 110 | this.notificationsService.error(this.i18n('Error'), err.message) |
108 | } | 111 | } |
109 | ) | 112 | ) |
@@ -129,8 +132,8 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Ca | |||
129 | }, | 132 | }, |
130 | 133 | ||
131 | err => { | 134 | err => { |
132 | this.isUpdatingVideo = false | 135 | this.error = err.message |
133 | this.notificationsService.error(this.i18n('Error'), err.message) | 136 | scrollToTop() |
134 | console.error(err) | 137 | console.error(err) |
135 | } | 138 | } |
136 | ) | 139 | ) |