You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've encountered an issue after upgrading from Hot Chocolate v13 to v14. In the project, I use an ErrorHandlingFilter (implementing IErrorFilter) to customize error responses. Previously, I could remove the path and extensions properties from the error object using methods like error.WithMessage(ex.Message).WithCode(ErrorCodes.BadUserInput).RemovePath().RemoveLocations(). This worked as expected in v13.
However, after upgrading to v14, these RemovePath() and RemoveLocations() calls no longer have any effect. The path and extensions properties are always present in the final error object.
After investigating, I found a change in MiddlewareContext.Global.cs file in v14
This line seems to be re-adding the path and locations to the error, overriding the removals.
My questions are:
Is this behavior intentional in v14?
Is there a recommended way to remove path and locations from error objects in v14 if we still need it?
The solution you'd like
Be able to remove the path and locations from the error object in HotChocolate V14.
The text was updated successfully, but these errors were encountered:
The GraphQL spec demands that field errors have a path and location. We now will always add a path to an error that is happening in a field execution context.
If an error can be associated to a particular field in the GraphQL result, it must contain an entry with the key path that details the path of the response field which experienced the error. This allows clients to identify whether a null result is intentional or caused by a runtime error.
Product
Hot Chocolate
Is your feature request related to a problem?
Hi team,
I've encountered an issue after upgrading from Hot Chocolate v13 to v14. In the project, I use an ErrorHandlingFilter (implementing IErrorFilter) to customize error responses. Previously, I could remove the path and extensions properties from the error object using methods like
error.WithMessage(ex.Message).WithCode(ErrorCodes.BadUserInput).RemovePath().RemoveLocations()
. This worked as expected in v13.However, after upgrading to v14, these
RemovePath()
andRemoveLocations()
calls no longer have any effect. The path and extensions properties are always present in the final error object.After investigating, I found a change in MiddlewareContext.Global.cs file in v14
graphql-platform/src/HotChocolate/Core/src/Execution/Processing/MiddlewareContext.Global.cs
Line 129 in 410d897
This line seems to be re-adding the path and locations to the error, overriding the removals.
My questions are:
Is this behavior intentional in v14?
Is there a recommended way to remove
path
andlocations
from error objects in v14 if we still need it?The solution you'd like
Be able to remove the path and locations from the error object in HotChocolate V14.
The text was updated successfully, but these errors were encountered: