Chalk home page
Docs
API
CLI
  1. Error Handling

Chalk returns an error channel in addition the requested feature values.

There are several types of errors one could expect:

Error categories

Request error

Request errors are raised before execution of your resolver code. They may occur due to invalid feature names in the input or a request that cannot be satisfied by the resolvers you have defined.

Field error

Field errors are raised while running a feature resolver for a particular field. For this type of error, you’ll find a feature and resolver attribute in the error type.

When a feature resolver crashes, you will receive null value in the response. To differentiate from a resolver returning a null value and a failure in the resolver, you need to check the error schema.

Network error

Network errors are thrown outside your resolvers. For example, your request was unauthenticated, connection failed, or an error occurred within Chalk.


Error schema

The online query interface for resolvers returns the following schema:

Response Schema

Attributes
dataFeatureResult[]
The outputs features and any query metadata (discussed in detail at Query Basics.)
errorsChalkError[]?
Errors encountered while running the resolvers. Each element in the list is a ChalkError. If no errors were encountered, this field is empty.

ChalkError

Attributes
codeErrorCode
The type of error, matching one of the error codes.
categoryErrorCode.kind
The category of the error, given in the type field for the error codes. This will be one of "REQUEST", "NETWORK", and "FIELD".
messagestring
A readable description of the error message.
exceptionobject?
The exception that caused the failure, if applicable.
Child attributes
kindstring
The name of the class of the exception.
messagestring
The message taken from the exception.
stacktracestring
The stacktrace produced by the code.
featurestring?
The fully qualified name of the failing feature, eg.user.identity.has_voip_phone.
resolverstring?
The fully qualified name of the failing resolver, eg.my.project.get_fraud_score.

Error code

Values
PARSE_FAILEDREQUEST
The query contained features that do not exist.
RESOLVER_NOT_FOUNDREQUEST
A resolver was required as part of running the dependency graph that could not be found.
INVALID_QUERYREQUEST
The query is invalid. All supplied features need to be rooted in the same top-level entity.
VALIDATION_FAILEDFIELD
A feature value did not match the expected schema (eg. `incompatible type "int"; expected "str"`)
RESOLVER_FAILEDFIELD
The resolver for a feature errored.
RESOLVER_TIMED_OUTFIELD
The resolver for a feature timed out.
UPSTREAM_FAILEDFIELD
A crash in a resolver that was to produce an input for the resolver crashed, and so the resolver could not run crashed, and so the resolver could not run.
UNAUTHENTICATEDNETWORK
The request was submitted with an invalid authentication header.
UNAUTHORIZEDNETWORK
The request has credentials that do not provide the required authorization to execute an operation.
INTERNAL_SERVER_ERRORNETWORK
An unspecified error occurred.