-
Notifications
You must be signed in to change notification settings - Fork 154
GraphQl-220: Implement exception logging #355
GraphQl-220: Implement exception logging #355
Conversation
Created custom error handler; Applied default error handling functionality
Implemented client and server errors logging
Maksym Novik seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. |
Probably, it could be a better idea to use \GraphQL\Error\ClientAware::isClientSafe to detect if it is a client-side error instead of \GraphQL\Error\ClientAware::getCategory. It this case there will be no need to update the virtualtypes every time new exception category is created. |
lib/internal/Magento/Framework/GraphQl/Query/ErrorHandlerInterface.php
Outdated
Show resolved
Hide resolved
…ception-logging#220
@naydav , @paliarush
|
@magento run all tests |
…ent-exception-logging#220 # Conflicts: # app/etc/di.xml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@novikor - please check my review
@novikor - I've put the comments to review from @naydav about my vision. Thank you! |
Cleaned up code.
Moved DI to graphql area; Create ResolveLogger service; Use ClientAvare->isClientSafe() to divide exceptions into client and server
Moved DI to graphql area; Create ResolveLogger service; Use ClientAvare->isClientSafe() to divide exceptions into client and server
bc45d86
to
6a5c7e2
Compare
seems to be ok - tested it locally with different error types. Waiting for test builds. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lib/internal/Magento/Framework/GraphQl/Query/Resolver/ResolveLogger.php
Outdated
Show resolved
Hide resolved
Yep. It will be finished this week. |
Removed client errors logging.
PR is ready for review. Integration or at least Unit tests will be provided at the end of the current week. |
@novikor, please try these steps:
Expected result(until #761 is not fixed): {
"errors": [
{
"debugMessage": "Call to a member function format() on boolean",
"message": "Internal server error",
"category": "internal",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"addSimpleProductsToCart"
]
}
],
"data": {
"addSimpleProductsToCart": null
}
} Actual result: {
"errors": [
{
"message": "Internal server error",
"category": "internal",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"addSimpleProductsToCart"
]
}
],
"data": {
"addSimpleProductsToCart": null
}
} It seems like a regression. Also, it doesn't work for me in production mode. I do not see any error log, do you see any? |
Looks strange. I will check again |
Hi, @TomashKhamlai . Use the next query:
|
I've tested your branch and it logs the same message in 2 places |
Removed duplicated logging to var/log/graphql.
Fixed |
Hi @novikor, thank you for your contribution! |
Description (*)
Created logging for client and server errors.
I use exception category from \GraphQL\Error\ClientAware to divide errors between the client (
var/log/graphql/client/exception.log
) and server (var/log/graphql/server/exception.log
).In case the category is not recognized, the errors will be logged into a general log (
var/log/graphql/exception.log
)Fixed Issues (if relevant)
Manual testing scenarios (*)
var/log/graphql/client/exception.log
var/log/graphql/server/exception.log
Contribution checklist (*)