X Tutup
The Wayback Machine - https://web.archive.org/web/20201202180336/https://github.com/microsoft/java-debug/pull/208
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1. add user error in DebugException #208

Merged
merged 14 commits into from Aug 22, 2018
Merged

1. add user error in DebugException #208

merged 14 commits into from Aug 22, 2018

Conversation

@andxu
Copy link
Collaborator

@andxu andxu commented Aug 20, 2018

  1. add user error logic in evaluation since a lot of them are reported in evaluation which is caused by known reasons(eg: compilation error).
  2. enable evaluation on hover
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
Copy link
Contributor

@testforstephen testforstephen left a comment

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.",

This comment has been minimized.

@testforstephen

testforstephen Aug 20, 2018
Contributor

typos. Cannot evalution -> Cannot evaluate

This comment has been minimized.

@andxu

andxu Aug 21, 2018
Author Collaborator

done

@@ -53,6 +53,7 @@
caps.supportsCompletionsRequest = true;
caps.supportsRestartFrame = true;
caps.supportsLogPoints = true;
caps.supportsEvaluateForHovers = true;

This comment has been minimized.

@testforstephen

testforstephen Aug 20, 2018
Contributor

By mistake? or Do you want to support EvaluateForHovers in this PR?

This comment has been minimized.

@andxu

andxu Aug 21, 2018
Author Collaborator

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()),

This comment has been minimized.

@testforstephen

testforstephen Aug 20, 2018
Contributor

typos. evaluation -> evaluate

This comment has been minimized.

@andxu

andxu Aug 21, 2018
Author Collaborator

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

This comment has been minimized.

@testforstephen

testforstephen Aug 20, 2018
Contributor

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.",

This comment has been minimized.

@testforstephen

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;

This comment has been minimized.

@Eskibear

Eskibear Aug 20, 2018
Member

confusing name userError for a boolean

This comment has been minimized.

@andxu

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;
}


This comment has been minimized.

@Eskibear

Eskibear Aug 20, 2018
Member

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<>();

This comment has been minimized.

@Eskibear

Eskibear Aug 20, 2018
Member

2 spaces here in private Map ?

andxu added 8 commits Aug 20, 2018
@andxu andxu force-pushed the andy_user_error2 branch from 455d2cc to 4bbfa09 Aug 21, 2018
@@ -134,6 +134,8 @@
<module name="ModifierOrder"/>
<module name="EmptyLineSeparator">
<property name="allowNoEmptyLineBetweenFields" value="true"/>
<property name="allowMultipleEmptyLines" value="false"/>

This comment has been minimized.

@yaohaizh

yaohaizh Aug 21, 2018

Why change this?

This comment has been minimized.

@andxu

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);

This comment has been minimized.

@testforstephen

testforstephen Aug 21, 2018
Contributor

Cannot get the failure reason from the name. -> EVALUATE_NOT_SUSPENDED_THREAD

Copy link
Contributor

@testforstephen testforstephen left a comment

This pr looks good to me.
Please add user error for DEBUG CONSOLE Auto-Complete feature too.

andxu added 4 commits Aug 22, 2018
@andxu andxu merged commit e9ed6a1 into master Aug 22, 2018
3 checks passed
3 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
license/cla All CLA requirements met.
Details
@andxu andxu deleted the andy_user_error2 branch Aug 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.
X Tutup