wavedrom icon indicating copy to clipboard operation
wavedrom copied to clipboard

Uncaught TypeError: e.charCodeAt is not a function

Open mithro opened this issue 6 years ago • 4 comments

On the latest chrome, when using the editor with the following JSON;

{
  "reg_definition": {
      "reg_name": "DATA",
      "reg_description": "Data from the last SETUP packet.  It will be 10 bytes long, because it will include the CRC16.  This is a FIFO; use `DATA_ACK` to advance the queue.",
      "reg": [
          { "name": "DATA",   "bits": 8, "attr": "RO", "description": "The next byte of SETUP data" }
      ]
  }
}

I get the following error in the Chrome console;

Uncaught TypeError: e.charCodeAt is not a function
    at t.exports (wavedrom.min.js:3)
    at t.exports (wavedrom.min.js:3)
    at t.exports (wavedrom.min.js:3)
    at t.exports (wavedrom.min.js:3)
    at t.exports (wavedrom.min.js:3)
    at t.exports (wavedrom.min.js:3)
    at Object.t.exports [as EditorRefresh] (wavedrom.min.js:3)
    at c (init.js:129)

mithro avatar Sep 02 '19 17:09 mithro

It should more like:

{
  "reg": [
    {"name": "DATA", "bits": 8, "attr": "RO", "description": "The next byte of SETUP data" }
  ]
}

drom avatar Sep 03 '19 03:09 drom

@drom Any chance the editor could report that you have invalid JSON / it doesn't understand the JSON output?

mithro avatar Sep 03 '19 04:09 mithro

Good idea. We should be able to check WaveJSON schema https://github.com/wavedrom/schema before trying to render.

drom avatar Sep 03 '19 04:09 drom

I just ran into this issue after upgrading wavedrom -- the older version worked, but the newer version silently failed with only that error in the console -- TypeError: e.charCodeAt is not a function

Could there be a more descriptive error generated when JSON isn't valid? In this case, there were trailing commas, which wavedrom apparently used to accept but now no longer does.

xobs avatar Mar 16 '20 00:03 xobs