Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

13
LINES

< > BotCompany Repo | #1015769 - extractAndPrintJavaParseError

JavaX fragment (include)

svoid extractAndPrintJavaParseError(S src, Throwable e) {
  print();
  S msg = takeFirstLines(2, innerMessage(e));
  print(msg);
  int line = parseIntOpt(regexpFirstGroupIC("line (\\d+)", msg));
  print();
  if (line != 0) {
    L<S> lines = lines(src);
    for (int i = max(1, line-5); i <= min(l(lines), line+5); i++)
      print((i == line ? "* " : "  ") + "LINE " + i + ": " + lines.get(i-1));
  }
  print();
}

Author comment

Began life as a copy of #1015768

download  show line numbers  debug dex   

Travelled to 10 computer(s): aoiabmzegqzx, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, tslmcundralx, tvejysmllsmz

No comments. add comment

Snippet ID: #1015769
Snippet name: extractAndPrintJavaParseError
Eternal ID of this version: #1015769/5
Text MD5: bd16d85573c6b349b4109c8ba8d4ce2a
Author: stefan
Category: javax / code analysis
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-10-27 16:55:48
Source code size: 426 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 154 / 178
Version history: 4 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1015769 & http://1015769.tinybrain.de