UserError
Error information returned by mutations. This object provides structured details about errors encountered during mutation operations, including the specific input field that caused the error, a descriptive message, and an optional error code.
Type Definition
type UserError {
field: [String]
message: String!
code: String
}
Fields
Field | Type | Description | Nullable | Related Types |
---|---|---|---|---|
field | [String] | Path to the input field that caused the error | Yes | String |
message | String! | The error message | No | String |
code | String | The error code | Yes | String |
Relationships
- field: Represents the path to the input field(s) that caused the error. It is an optional array of strings, allowing for nested field paths.
- message: A required string providing a human-readable description of the error.
- code: An optional string that can be used to programmatically identify the type of error.
Usage Examples
Basic Query
{
userError {
field
message
code
}
}
Field Selection
{
userError {
message
}
}
Nested Queries
Since UserError
fields are scalar or list of scalars, nested queries are not applicable beyond selecting the field
array elements.
{
userError {
field
message
}
}
Filtering and Sorting
The UserError
type itself does not support filtering or sorting as it is typically returned as part of mutation payloads indicating errors.
Implements
UserError
does not implement any interfaces.
Connections
UserError
does not have connection fields.
Related Types
String
[String]
Best Practices
- Always check the
message
field to understand the error context. - Use the
field
array to highlight exactly which input fields caused the error, especially useful for nested input objects. - Utilize the
code
field when available to implement error-specific handling logic in your client applications. - Handle cases where
field
orcode
may benull
gracefully. - Since
UserError
is returned by mutations, always inspect this object after mutation calls to provide meaningful feedback to users.
Notes
- The
UserError
type is designed to improve error handling by providing structured error details. - This API currently requires no authentication; however, this may change in future versions.
- The
field
array can help map errors back to complex input structures, improving debugging and user experience. - There are no computed or derived fields in
UserError
. - No field arguments are defined for this type.
- Because
UserError
is typically returned in mutation responses, it is important to handle it efficiently to avoid performance bottlenecks in client applications.
Last updated on