Skip to content

Sentry reports #1043

@jcubic

Description

@jcubic

Issue summary

Error reported by Sentry

  • TypeError: Cannot read properties of undefined (reading 'match')

Steps to reproduce

Unknown

Browser and OS

Edge

Additional notes

This is the stack trace:

TypeError: Cannot read properties of undefined (reading 'match')
  at draw_cursor_line (/js/jquery.terminal.js:3358:39)
  at None (/js/jquery.terminal.js:3566:29)
  at ce.fn.init.position (/js/jquery.terminal.js:4002:25)
  at ce.fn.init.delete (/js/jquery.terminal.js:3833:34)
  at Object.delete_character_backward [as HOLD+BACKSPACE] (/js/jquery.terminal.js:2706:35)
...
(3 additional frame(s) were not displayed)

It may require adding some diagnostics to the library that dumps internal state (local variables) to some service.

The error happens in this code:

// more lines, cursor in the middle
var line_index;
var current;
new_pos = pos;
for (i = 0; i < array.length; ++i) {
    var current_len = $.terminal.length(array[i]);
    if (new_pos > current_len) {
        new_pos -= current_len;
    } else {
        break;
    }
}
current = array[i];
line_index = i;
// cursor on first character in line
if (new_pos === length(current)) {
    new_pos = 0;
    current = array[++line_index];
    if (current === undefined) {
        //should never happen
        var msg = $.terminal.defaults.strings.redrawError;
        throw new Error(msg);
    }
}
draw_cursor_line(current, {
    length: array.length,
    position: new_pos
});
lines_before(array.slice(0, line_index));
lines_after(array.slice(line_index + 1));

current is somehow undefined. The error thrown should be added outside the if statement. And the diagnostics need to be printed.

Maybe add what isomorphic-git is using, add a message to report the issue on GitHub.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions