Database, network and service failures¶
Source: R/errors.R ยท Help: ?service_errors
Errors at the boundary with another system. Their failure metadata stays
"unknown" by default, because only the backend's response can say whether
a retry would help; attach that answer with with_failure_metadata() when
you have it.
Usage¶
database_connection_error(db_url, message = NULL, parent = NULL, call = NULL)
query_execution_error(query, parent = NULL, call = NULL)
transaction_error(
transaction_id = NULL,
message = NULL,
parent = NULL,
call = NULL
)
host_unreachable_error(host, message = NULL, parent = NULL, call = NULL)
connection_timeout_error(host, timeout, parent = NULL, call = NULL)
api_error(
endpoint,
status_code = NULL,
message = NULL,
parent = NULL,
call = NULL
)
Arguments¶
db_url- The database connection URL.
message- A message to use instead of the default.
parent- The condition that caused this one, or
NULL. call- The call to report, or
NULL. query- The SQL that failed.
transaction_id- Optional identifier of the transaction.
host- The host that could not be reached.
timeout- The timeout that elapsed, in seconds.
endpoint- The API endpoint URL.
status_code- The HTTP status code, if a response arrived.
Value¶
A condition inheriting from dataexcept_database_error,
dataexcept_network_error or dataexcept_pipeline_error.
Details¶
Connection URLs routinely carry a user name and password, and API endpoints carry tokens in their query string. Both are redacted before they reach the condition.
Examples¶
err <- database_connection_error("postgresql://analyst:s3cret@db.internal:5432/sales")
conditionMessage(err)
err <- api_error("https://api.example.com/v1/orders?api_key=abc123", status_code = 503L)
err <- with_failure_metadata(err, failure_metadata("transient", TRUE, 30))
condition_to_json(err)
See also¶
pipeline_errors for the other failures of calls to external services.
Other dataexcept errors:
data_engineering_errors,
data_frame_errors,
data_quality_errors,
file_errors,
job_errors,
model_quality_errors,
modelling_errors,
pipeline_errors,
validation_error()