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

Log the invalid key or function parameter #1155

Merged
merged 1 commit into from
Mar 1, 2024
Merged

Log the invalid key or function parameter #1155

merged 1 commit into from
Mar 1, 2024

Conversation

xuzhg
Copy link
Member

@xuzhg xuzhg commented Jan 10, 2024

Fixes #1152,

if we have the logger enabled in the TryMatch. Otherwise, keep to throw exception.

ILoggerFactory loggerFactory = context.HttpContext?.RequestServices?.GetService<ILoggerFactory>();
if (loggerFactory != null)
{
loggerFactory.CreateLogger("ODataFunctionParameterMatcher").LogError(message, ex);
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious is there's a way we can verify that a logger is created successfully and the error message logged...

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried to add the test, but, it seems we have to set up more things. I will try more later.

… enabled in the TryMatch. Otherwise, keep to throw exception.
@xuzhg xuzhg merged commit 5372813 into main Mar 1, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OData Query parameters are not working in 8.2.3
2 participants