Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Viz not recover after error #59

Closed
mstefaniuk opened this issue Jan 13, 2016 · 5 comments
Closed

Viz not recover after error #59

mstefaniuk opened this issue Jan 13, 2016 · 5 comments

Comments

@mstefaniuk
Copy link

When Viz is called subsequently (the same instance) it cannot recover when unclosed quotes error is thrown. Failing case looks as follows:

define(["viz"], function(viz) {

  describe("Viz.js", function() {
    it("should recover after unclosed quotes error", function() {
      expect(function() {
        viz([
          'digraph {',
          ' a -> b [label="erroneous]',
          '}'].join("\n"));
      }).toThrow();
      var svg = viz([
        'digraph {',
        ' a -> b [label="correcteous"]',
        '}'].join("\n"));
      expect(svg).toBeDefined();
    });
  });
});

First call throws an exception with Error: syntax error in line 2 near '' as expected. Subsequent gives Error: syntax error in line 1 near '"' until new Viz instance is created.

Viz is loaded using require.js with shim.

Kazunori-Kimura added a commit to Kazunori-Kimura/electron-viz that referenced this issue Apr 26, 2016
- [Viz not recover after error
  #59](mdaines/viz-js#59) の不具合を
  回避するため、連続してviz.jsがエラーとなった場合は
  viz.jsを読み込み直すように修正
sverweij added a commit to sverweij/atom-graphviz-preview-plus that referenced this issue Sep 27, 2016
sverweij added a commit to sverweij/atom-graphviz-preview-plus that referenced this issue Sep 29, 2016
@jackycute
Copy link

We also experienced this issue.

mdaines added a commit that referenced this issue Jan 3, 2017
mdaines added a commit that referenced this issue Jan 3, 2017
This should reset the scanner state for subsequent calls if we run into certain syntax errors.
@mdaines
Copy link
Owner

mdaines commented Jan 3, 2017

c687a63 should address this. I am attaching a build of that version for testing.

viz.js.zip

@jackycute
Copy link

I just tested it, it works.
But the error message seems a bit weird.

abort() at Error
If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.

@mdaines
Copy link
Owner

mdaines commented Jan 4, 2017

So it does. I'll update the test to check for the correct error message and see if I can find the problem.

mdaines added a commit that referenced this issue Jan 14, 2017
@mdaines
Copy link
Owner

mdaines commented Jan 14, 2017

This should be addressed in 2257a40 and the fix will be in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants