Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
1. add user error in DebugException #208
Conversation
andxu
commented
Aug 20, 2018
|
2. add user error logic in evaluation since a lot of them are reported in evaluation which is caused by known reasons(eg: compilation error). 3. enable evaluation on hover
|
How about CompletionsProvider? It has similar user errors. |
| @@ -135,6 +137,13 @@ public void initialize(IDebugAdapterContext context, Map<String, Object> props) | |||
| compiledExpression = engine.getCompiledExpression(expression, stackframe); | |||
| } | |||
|
|
|||
| if (compiledExpression.hasErrors()) { | |||
| completableFuture.completeExceptionally(AdapterUtils.createUserErrorDebugException( | |||
| String.format("Cannot evalution expression because of compilation error(s): %s.", | |||
| @@ -53,6 +53,7 @@ | |||
| caps.supportsCompletionsRequest = true; | |||
| caps.supportsRestartFrame = true; | |||
| caps.supportsLogPoints = true; | |||
| caps.supportsEvaluateForHovers = true; | |||
testforstephen
Aug 20, 2018
Contributor
By mistake? or Do you want to support EvaluateForHovers in this PR?
| throw AdapterUtils.createCompletionException( | ||
| String.format("Cannot evalution expression because of %s.", cause.toString()), | ||
| String.format("Cannot evaluation expression because of %s.", cause.toString()), |
| * Create a debug exception with userError flag. | ||
| * @param message the error message | ||
| * @param errorCode the error code | ||
| * @param userError the boolean value of whether this exception is caused by a known user error |
| ErrorCode.EVALUATE_FAILURE); | ||
| // stackFrameReference is null means the given thread is running | ||
| throw new CompletionException(AdapterUtils.createUserErrorDebugException( | ||
| "Failed to evaluate. Reason: Cannot evaluate because the thread is resumed.", |
testforstephen
Aug 20, 2018
Contributor
=> Failed to evaluate. Reason: Cannot evaluate because the thread is not suspended.
| @@ -15,6 +15,8 @@ | |||
| private static final long serialVersionUID = 1L; | |||
| private int errorCode; | |||
|
|
|||
| private boolean userError = false; | |||
andxu
Aug 21, 2018
Author
Collaborator
No better name, I think the java doc may eliminate the confusion
| public DebugException(String message, Throwable cause, int errorCode) { | ||
| super(message, cause); | ||
| this.errorCode = errorCode; | ||
| } | ||
|
|
||
|
|
| @@ -39,6 +40,7 @@ | |||
| private Map<String, Integer> commandCountMap = new HashMap<>(); | |||
| private Map<String, Integer> breakpointCountMap = new HashMap<>(); | |||
| private Map<Integer, RequestEvent> requestEventMap = new HashMap<>(); | |||
| private Map<String, Integer> userErrorCount = new HashMap<>(); | |||
…debug into andy_user_error2
| @@ -134,6 +134,8 @@ | |||
| <module name="ModifierOrder"/> | |||
| <module name="EmptyLineSeparator"> | |||
| <property name="allowNoEmptyLineBetweenFields" value="true"/> | |||
| <property name="allowMultipleEmptyLines" value="false"/> | |||
andxu
Aug 21, 2018
Author
Collaborator
Some bad styles are founded by yanzh but not by checkstyle, so I enhanced the rules
| COMPLETIONS_FAILURE(1017); | ||
| COMPLETIONS_FAILURE(1017), | ||
| EVALUATION_COMPILE_ERROR(2001), | ||
| EVALUATE_NOT_SUSPEND(2002); |
testforstephen
Aug 21, 2018
Contributor
Cannot get the failure reason from the name. -> EVALUATE_NOT_SUSPENDED_THREAD
|
This pr looks good to me. |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
