Watch
0
0
Fork
You've already forked hyperhive
0

a review-classifier key in the wrong shape or rejected by anthropic logs how to fix it

This commit is contained in:
atlas 2026-11-11 19:01:47 +01:00
commit 4782f69110

View file

@ -140,6 +140,18 @@ impl Error {
Self::Vault(e) if matches!(**e, vaultrs::error::ClientError::APIError { code: 403, .. })
)
}
/// Whether the store answered, but what it holds did not decode as the
/// type the caller asked for: a field is missing or has another type.
/// The error's own text quotes the stored value, so a caller that reports
/// this case writes its own message rather than showing the error.
#[must_use]
pub fn is_undecodable(&self) -> bool {
matches!(
self,
Self::Vault(e) if matches!(**e, vaultrs::error::ClientError::JsonParseError { .. })
)
}
}
/// Install `aws-lc-rs` as the process-wide rustls crypto provider. Call it
@ -175,6 +187,22 @@ mod tests {
assert!(!Error::MissingEnv("BAO_ADDR").is_denied());
}
#[test]
fn only_a_decode_failure_is_undecodable() {
let decode =
serde_json::from_value::<String>(serde_json::json!({ "value": "k" })).unwrap_err();
let undecodable =
Error::from(vaultrs::error::ClientError::JsonParseError { source: decode });
assert!(undecodable.is_undecodable());
// The controls: a denial and a local failure are not decode failures.
let denied = Error::from(vaultrs::error::ClientError::APIError {
code: 403,
errors: Vec::new(),
});
assert!(!denied.is_undecodable());
assert!(!Error::MissingEnv("BAO_ADDR").is_undecodable());
}
#[test]
fn a_tls_client_config_builds_once_the_provider_is_installed() {
install_crypto_provider();