Skip to content

Commit

Permalink
🐛 Fix uncaught exception when previewing a CSV
Browse files Browse the repository at this point in the history
Fixes #41, fixes #43, fixes #44, fixes #46, fixes #47
  • Loading branch information
abe33 committed Apr 28, 2016
1 parent 5154a85 commit dbe569d
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/csv-editor-element.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class CSVEditorElement extends HTMLElement

@subscriptions.add @model.onDidFailOpen ({err}) =>
@hideProgress()
@createFormView()
@form.alert(err.message)

@subscriptions.add @model.onDidOpen ({editor}) =>
Expand Down Expand Up @@ -89,6 +90,8 @@ class CSVEditorElement extends HTMLElement
delete @tableElement

createFormView: ->
return if @form?

@removeTableEditor()

@formContainer = document.createElement('div')
Expand Down
2 changes: 1 addition & 1 deletion lib/csv-editor.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ class CSVEditor
input.stop()
input.removeListener 'readable', read
input.removeListener 'end', end
input.removeListener 'error', error
# input.removeListener 'error', error
resolve(output[0...limit])

read = ->
Expand Down
102 changes: 102 additions & 0 deletions spec/fixtures/failing-after-preview.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
foo;bar;baz
"foo";"bar";"baz"

0 comments on commit dbe569d

Please sign in to comment.