553 value = si.subKind().hasValue() |
553 value = si.subKind().hasValue() |
554 ? expunge(value) |
554 ? expunge(value) |
555 : ""; |
555 : ""; |
556 } catch (ResolutionException ex) { |
556 } catch (ResolutionException ex) { |
557 DeclarationSnippet sn = (DeclarationSnippet) state.maps.getSnippetDeadOrAlive(ex.id()); |
557 DeclarationSnippet sn = (DeclarationSnippet) state.maps.getSnippetDeadOrAlive(ex.id()); |
558 exception = new UnresolvedReferenceException(sn, ex.getStackTrace()); |
558 exception = new UnresolvedReferenceException(sn, translateExceptionStack(ex)); |
559 } catch (UserException ex) { |
559 } catch (UserException ex) { |
560 exception = translateExecutionException(ex); |
560 exception = new EvalException(translateExceptionMessage(ex), |
|
561 ex.causeExceptionClass(), |
|
562 translateExceptionStack(ex)); |
561 } catch (RunException ex) { |
563 } catch (RunException ex) { |
562 // StopException - no-op |
564 // StopException - no-op |
563 } catch (InternalException ex) { |
565 } catch (InternalException ex) { |
564 state.debug(ex, "invoke"); |
566 state.debug(ex, "invoke"); |
565 } catch (EngineTerminationException ex) { |
567 } catch (EngineTerminationException ex) { |
757 elems[i] = new StackTraceElement(r.getClassName(), r.getMethodName(), null, r.getLineNumber()); |
759 elems[i] = new StackTraceElement(r.getClassName(), r.getMethodName(), null, r.getLineNumber()); |
758 } else { |
760 } else { |
759 elems[i] = r; |
761 elems[i] = r; |
760 } |
762 } |
761 } |
763 } |
|
764 return elems; |
|
765 } |
|
766 |
|
767 private String translateExceptionMessage(Exception ex) { |
762 String msg = ex.getMessage(); |
768 String msg = ex.getMessage(); |
763 if (msg.equals("<none>")) { |
769 return msg.equals("<none>") |
764 msg = null; |
770 ? null |
765 } |
771 : msg; |
766 return new EvalException(msg, ex.causeExceptionClass(), elems); |
|
767 } |
772 } |
768 |
773 |
769 private boolean isWrap(StackTraceElement ste) { |
774 private boolean isWrap(StackTraceElement ste) { |
770 return PREFIX_PATTERN.matcher(ste.getClassName()).find(); |
775 return PREFIX_PATTERN.matcher(ste.getClassName()).find(); |
771 } |
776 } |