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.", | |||
testforstephen
Aug 20, 2018
Contributor
typos. Cannot evalution -> Cannot evaluate
typos. Cannot evalution -> Cannot evaluate
andxu
Aug 21, 2018
Author
Collaborator
done
done
| @@ -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?
By mistake? or Do you want to support EvaluateForHovers in this PR?
andxu
Aug 21, 2018
Author
Collaborator
No, it is expected in this pr to enable EvaluateForHovers
No, it is expected in this pr to enable EvaluateForHovers
| throw AdapterUtils.createCompletionException( | ||
| String.format("Cannot evalution expression because of %s.", cause.toString()), | ||
| String.format("Cannot evaluation expression because of %s.", cause.toString()), |
testforstephen
Aug 20, 2018
Contributor
typos. evaluation -> evaluate
typos. evaluation -> evaluate
andxu
Aug 21, 2018
Author
Collaborator
done
done
| * 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 |
testforstephen
Aug 20, 2018
Contributor
of -> indicates
of -> indicates
| 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.
=> 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; | |||
Eskibear
Aug 20, 2018
Member
confusing name userError for a boolean
confusing name userError for a boolean
andxu
Aug 21, 2018
Author
Collaborator
No better name, I think the java doc may eliminate the confusion
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; | ||
| } | ||
|
|
||
|
|
Eskibear
Aug 20, 2018
Member
unnecessary newline here.
unnecessary newline here.
| @@ -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<>(); | |||
Eskibear
Aug 20, 2018
•
Member
2 spaces here in private Map ?
2 spaces here in private Map ?
…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"/> | |||
yaohaizh
Aug 21, 2018
Why change this?
Why change this?
andxu
Aug 21, 2018
Author
Collaborator
Some bad styles are founded by yanzh but not by checkstyle, so I enhanced the rules
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
Cannot get the failure reason from the name. -> EVALUATE_NOT_SUSPENDED_THREAD
|
This pr looks good to me. |