Skip to content

Conversation

@mssfang
Copy link
Contributor

@mssfang mssfang commented Jul 24, 2019

PR includes:
(1) the implementation for Rule 9: Thrown exception use ClientLogger
To throw an exception, Must throw it through a 'logger.logExceptionAsError', rather than by directly calling 'throw exception'.

Skip check if throw exception from

  • Static method
  • Static class
  • Constructor

(2) code fixes based on the new rule: ThrowFromClientLoggerCheck.java

(3) a minor fixes for NoImplInPublicAPI.java checker:

  • Removes track 2 and implementation check in Java Code instead of suppressing the rule

(4) fixes for ServiceClientBuilder checker for Storage service.

Copy link
Member

@joshfree joshfree left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, pending changes

@mssfang mssfang requested a review from alzimmermsft as a code owner July 26, 2019 21:07
@mssfang
Copy link
Contributor Author

mssfang commented Aug 15, 2019

The rule requirement changes. Thank you for your past and next code reviews. Includes the fixes for Storages as well now.

@mssfang mssfang requested a review from joshfree August 15, 2019 22:38
} else {
return;
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this no longer necessary as you are instead configuring it via suppressions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. you are right.

@mssfang mssfang requested a review from JonathanGiles August 16, 2019 05:28
@mssfang mssfang requested a review from gapra-msft as a code owner August 18, 2019 19:22
protected Object handleResumeOperation(HttpRequest httpRequest, OperationDescription operationDescription, SwaggerMethodParser methodParser, Type returnType, Context context)
throws Exception {
throw new Exception("The resume operation is not available in the base RestProxy class.");
throw logger.logExceptionAsError(new RuntimeException("The resume operation is not available in the base RestProxy class."));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need double confirm that change Exception to RuntimeException. If can't, will suppress this error

Copy link
Member

@alzimmermsft alzimmermsft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good to me, we'll want to file issues to each library to update whether the exceptions should be logged as warnings or errors, this is important to help reduce non-important logging and reducing how many logs customs have.

@mssfang mssfang merged commit 9884b8a into Azure:master Aug 20, 2019
@mssfang mssfang deleted the CS-Logger branch August 20, 2019 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants