@@ -374,34 +374,30 @@ end
374374 private def findErrorSource (thr : Throwable , filename : String ): Int = {
375375 val err = thr.getMessage
376376 if (err.startsWith(" (SyntaxError)" )) {
377- val pLineS = """ (?<=:)(\d+):(.*)""" .r
378- err match {
379- case pLineS(line, text) =>
380- logger.debug(" SyntaxError error line: " + line)
381- if (text != null ) script_error.text = text
382- logger.debug(" SyntaxError: " + script_error.text)
383- script_error.lineNum = line.toInt
384- script_error.columnNum = - 1
385- script_error.errType = " SyntaxError"
386- case _ =>
377+ """ (?<=:)(\d+):(.*)""" .r.findFirstMatchIn(err).foreach { m =>
378+ val line = m.group(1 )
379+ val text = m.group(2 )
380+ logger.debug(" SyntaxError error line: " + line)
381+ if (text != null ) script_error.text = text
382+ logger.debug(" SyntaxError: " + script_error.text)
383+ script_error.lineNum = line.toInt
384+ script_error.columnNum = - 1
385+ script_error.errType = " SyntaxError"
387386 }
388-
389387 } else {
390388 script_error.errType = """ (?<=\()(\w*)""" .r
391389 .findFirstMatchIn(err).map(_ group 1 ).getOrElse(script_error.errType)
392390
393391 val cause = thr.getCause
394- cause.getStackTrace
395- .filter(line => line.getFileName == filename)
396- .map(line => {
392+ cause.getStackTrace.find(line => line.getFileName == filename)
393+ .foreach { line =>
397394 script_error.text = cause.getMessage
398395 script_error.columnNum = - 1
399396 script_error.lineNum = line.getLineNumber
400397 script_error.text = thr.getMessage
401398 script_error.errType = """ (?<=org.knime.)(.*)(?=:)""" .r
402399 .findFirstMatchIn(err).map(_ group 1 ).getOrElse(" RuntimeError" )
403- // break
404- }).head
400+ }
405401 }
406402 script_error.msg = " script" + (script_error.lineNum match {
407403 case - 1 => " ] stopped with error at line --unknown--"
0 commit comments