Skip to content
This repository was archived by the owner on Mar 9, 2023. It is now read-only.

Commit 8ace394

Browse files
committed
Improve error msg
1 parent a96949b commit 8ace394

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

src/PivotTable.vue

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -313,16 +313,7 @@ export default {
313313
})
314314
},
315315
saveTableWithText (format) {
316-
switch (format) {
317-
case 'csv':
318-
downloadTableWith('csv', this.cols, this.colFields, this.rows, this.rowFields, this.rowHeaderSize, this.values, this.filename)
319-
break
320-
case 'tsv':
321-
downloadTableWith('tsv', this.cols, this.colFields, this.rows, this.rowFields, this.rowHeaderSize, this.values, this.filename)
322-
break
323-
default:
324-
break
325-
}
316+
downloadTableWith(format, this.cols, this.colFields, this.rows, this.rowFields, this.rowHeaderSize, this.values, this.filename)
326317
}
327318
},
328319
watch: {

src/util.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export function downloadTableWith (format, cols, colFields, rows, rowFields, rowHeaderSize, values, filename) {
22
if (format !== 'tsv' && format !== 'csv') {
3-
throw Error('Invalid format on downloadTable')
3+
throw Error('Invalid format on downloading, only "tsv" or "csv" can be used.')
44
}
55
const _filename = (filename || getFilenameByDate(new Date())) + '.' + format
66
const delimiter = format === 'tsv' ? '\t' : ','

0 commit comments

Comments
 (0)