Skip to content
This repository has been archived by the owner on Oct 21, 2020. It is now read-only.

Commit

Permalink
fix(download-progress): add error handler
Browse files Browse the repository at this point in the history
  • Loading branch information
devinus committed Feb 21, 2018
1 parent 8362414 commit dabac8c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/components/download-progress/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@ import { debounce } from '@ember/runloop';

import { on } from 'ember-decorators/object/evented';

import { defineError } from 'ember-exex/error';

export const STATUS_DOWNLOADING = 'downloading';
export const STATUS_VERIFYING = 'verifying';
export const STATUS_EXTRACTING = 'extracting';

export const DownloadError = defineError({
name: 'DownloadError',
message: 'Error downloading {asset}',
});

export default Component.extend({
downloader: null,

Expand Down Expand Up @@ -37,6 +44,11 @@ export default Component.extend({
downloader.off('done', this, this.onDone);
},

onError() {
const asset = this.get('asset');
throw new DownloadError({ params: { asset } });
},

onProgress(value) {
debounce(this, this.updateProgress, value, 250, true);
},
Expand Down

0 comments on commit dabac8c

Please sign in to comment.