Skip to content

Errors with large data structures became harder to read #108

@oakes

Description

@oakes

I use expound in edna and I noticed that errors in 0.7.1 were harder to read than in 0.7.0 when they occur inside a large outer data structure. In 0.7.0, it points to the specific part of the data structure first:

Exception in thread "main" java.lang.Exception: -- Syntax error -------------------

  [...
   [:guitarx
    ^^^^^^^^
    ...
    ...
    ...
    ...
    ...
    ...
    ...
    ...
    ...
    ...
    ...
    ...]
<snip>

In 0.7.1, it prints the entire data structure first, and you have to scroll (sometimes far) down to see it eventually point to the specific part of the data structure where the error is:

Exception in thread "main" java.lang.Exception: -- Spec failed --------------------

  [{:tempo 80}
   [:guitarx {:octave 3} 1/16 :b :+c 1/8 :+d :b :+c :a :b :g :a]
   [:banjo {:octave 3} 1/16 :b :+c 1/8 :+d :b :+c :a :b :g :a]
   [:guitar {:octave 3} 1/16 :b :+c 1/8 :+d :b :+c :a :b :g :a]
   [:guitar {:octave 3} 1/2 :d 1/8 :g :g :a :b :g :b 1/2 :a]
   [:banjo {:octave 3} 1/8 :g :g :a :b 1/2 :g]
   [:guitar {:octave 2} 1/16 :g :g 1/8 :g :a :b :+c :+d :+c 1/2 :b]
   [:banjo {:octave 3} 1/16 :g :g 1/8 :g :a :b :+c :+d :+c 1/2 :b]
   [:guitar {:octave 2} 1/16 :g :g 1/8 :g :a :b :+c :+d :+c 1/2 :b]
   [:banjo {:octave 3} 1/16 :g :g 1/8 :g :a :b :+c :+d :+c 1/2 :b]
   [:guitar {:octave 3} 1/16 :g :g 1/8 :g :a :b :+c :+d :+c 1/2 :b]
   [:banjo {:octave 3} 1/16 :g :g 1/8 :g :a :b :+c :+d :+c 1/2 :b]
   [:guitar
    {:octave 4}
    1/16
    #{:-g :-b :d}
    #{:-g :-b :d}
<snip>
-- Spec failed --------------------

  [...
   [:guitarx {:octave 3} 1/16 :b :+c 1/8 :+d :b :+c :a :b :g :a]
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   ...
   ...
   ...
   ...
   ...
   ...
   ...
   ...
<snip>
-- Syntax error -------------------

  [...
   [:guitarx
    ^^^^^^^^
    ...
    ...
    ...
    ...
    ...
    ...
    ...
    ...
    ...
    ...
    ...
    ...]
<snip>

I posted a code example and the output of both versions here https://gist.github.com/oakes/dbc902e8fb077d6430fa0909cf4d7272

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions