Delet unused runner error variant.

This commit is contained in:
jcamiel 2023-11-26 17:17:24 +01:00
parent a4df7f79a0
commit 2a4d15fa7f
No known key found for this signature in database
GPG Key ID: 07FF11CFD55356CC

View File

@ -20,7 +20,6 @@ use std::path::PathBuf;
use hurl_core::ast::SourceInfo; use hurl_core::ast::SourceInfo;
use crate::http::{HttpError, RequestedHttpVersion}; use crate::http::{HttpError, RequestedHttpVersion};
use crate::runner::Value;
/// Represents a single instance of a runtime error, usually triggered by running a /// Represents a single instance of a runtime error, usually triggered by running a
/// [`hurl_core::ast::Entry`]. Running a Hurl content (see [`crate::runner::run`]) returns a list of /// [`hurl_core::ast::Entry`]. Running a Hurl content (see [`crate::runner::run`]) returns a list of
@ -54,10 +53,7 @@ pub enum RunnerError {
actual: String, actual: String,
}, },
CouldNotParseResponse, CouldNotParseResponse,
CouldNotResolveProxyName,
CouldNotResolveHost(String),
CouldNotUncompressResponse(String), CouldNotUncompressResponse(String),
FailToConnect,
FileReadAccess { FileReadAccess {
value: String, value: String,
}, },
@ -65,7 +61,6 @@ pub enum RunnerError {
FilterInvalidEncoding(String), FilterInvalidEncoding(String),
FilterInvalidInput(String), FilterInvalidInput(String),
FilterMissingInput, FilterMissingInput,
FilterRegexNoCapture,
HttpConnection(String), HttpConnection(String),
InvalidJson { InvalidJson {
value: String, value: String,
@ -81,16 +76,12 @@ pub enum RunnerError {
InvalidUrlPrefix(String), InvalidUrlPrefix(String),
NoQueryResult, NoQueryResult,
QueryHeaderNotFound, QueryHeaderNotFound,
QueryCookieNotFound,
QueryInvalidJsonpathExpression { QueryInvalidJsonpathExpression {
value: String, value: String,
}, },
QueryInvalidXpathEval, QueryInvalidXpathEval,
QueryInvalidXml, QueryInvalidXml,
QueryInvalidJson, QueryInvalidJson,
PredicateType,
PredicateValue(Value),
SslCertificate(String),
TemplateVariableNotDefined { TemplateVariableNotDefined {
name: String, name: String,
}, },
@ -99,7 +90,6 @@ pub enum RunnerError {
value: String, value: String,
expecting: String, expecting: String,
}, },
Timeout,
TooManyRedirect, TooManyRedirect,
UnsupportedContentEncoding(String), UnsupportedContentEncoding(String),
UnsupportedHttpVersion(RequestedHttpVersion), UnsupportedHttpVersion(RequestedHttpVersion),
@ -126,16 +116,12 @@ impl hurl_core::error::Error for Error {
RunnerError::AssertStatus { .. } => "Assert status code".to_string(), RunnerError::AssertStatus { .. } => "Assert status code".to_string(),
RunnerError::AssertVersion { .. } => "Assert HTTP version".to_string(), RunnerError::AssertVersion { .. } => "Assert HTTP version".to_string(),
RunnerError::CouldNotParseResponse => "HTTP connection".to_string(), RunnerError::CouldNotParseResponse => "HTTP connection".to_string(),
RunnerError::CouldNotResolveHost(_) => "HTTP connection".to_string(),
RunnerError::CouldNotResolveProxyName => "HTTP connection".to_string(),
RunnerError::CouldNotUncompressResponse(..) => "Decompression error".to_string(), RunnerError::CouldNotUncompressResponse(..) => "Decompression error".to_string(),
RunnerError::FailToConnect => "HTTP connection".to_string(),
RunnerError::FileReadAccess { .. } => "File read access".to_string(), RunnerError::FileReadAccess { .. } => "File read access".to_string(),
RunnerError::FilterDecode { .. } => "Filter Error".to_string(), RunnerError::FilterDecode { .. } => "Filter Error".to_string(),
RunnerError::FilterInvalidEncoding { .. } => "Filter Error".to_string(), RunnerError::FilterInvalidEncoding { .. } => "Filter Error".to_string(),
RunnerError::FilterInvalidInput { .. } => "Filter Error".to_string(), RunnerError::FilterInvalidInput { .. } => "Filter Error".to_string(),
RunnerError::FilterMissingInput => "Filter Error".to_string(), RunnerError::FilterMissingInput => "Filter Error".to_string(),
RunnerError::FilterRegexNoCapture => "Filter Error".to_string(),
RunnerError::HttpConnection { .. } => "HTTP connection".to_string(), RunnerError::HttpConnection { .. } => "HTTP connection".to_string(),
RunnerError::InvalidCharset { .. } => "Invalid charset".to_string(), RunnerError::InvalidCharset { .. } => "Invalid charset".to_string(),
RunnerError::InvalidDecoding { .. } => "Invalid decoding".to_string(), RunnerError::InvalidDecoding { .. } => "Invalid decoding".to_string(),
@ -144,18 +130,13 @@ impl hurl_core::error::Error for Error {
RunnerError::InvalidUrl(..) => "Invalid URL".to_string(), RunnerError::InvalidUrl(..) => "Invalid URL".to_string(),
RunnerError::InvalidUrlPrefix(..) => "Invalid URL".to_string(), RunnerError::InvalidUrlPrefix(..) => "Invalid URL".to_string(),
RunnerError::NoQueryResult => "No query result".to_string(), RunnerError::NoQueryResult => "No query result".to_string(),
RunnerError::PredicateType => "Assert - inconsistent predicate type".to_string(),
RunnerError::PredicateValue { .. } => "Assert - predicate value failed".to_string(),
RunnerError::QueryCookieNotFound => "Cookie not found".to_string(),
RunnerError::QueryHeaderNotFound => "Header not found".to_string(), RunnerError::QueryHeaderNotFound => "Header not found".to_string(),
RunnerError::QueryInvalidJson => "Invalid JSON".to_string(), RunnerError::QueryInvalidJson => "Invalid JSON".to_string(),
RunnerError::QueryInvalidJsonpathExpression { .. } => "Invalid JSONPath".to_string(), RunnerError::QueryInvalidJsonpathExpression { .. } => "Invalid JSONPath".to_string(),
RunnerError::QueryInvalidXml => "Invalid XML".to_string(), RunnerError::QueryInvalidXml => "Invalid XML".to_string(),
RunnerError::QueryInvalidXpathEval => "Invalid XPath expression".to_string(), RunnerError::QueryInvalidXpathEval => "Invalid XPath expression".to_string(),
RunnerError::SslCertificate { .. } => "SSL certificate".to_string(),
RunnerError::TemplateVariableInvalidType { .. } => "Invalid variable type".to_string(), RunnerError::TemplateVariableInvalidType { .. } => "Invalid variable type".to_string(),
RunnerError::TemplateVariableNotDefined { .. } => "Undefined variable".to_string(), RunnerError::TemplateVariableNotDefined { .. } => "Undefined variable".to_string(),
RunnerError::Timeout => "HTTP connection".to_string(),
RunnerError::TooManyRedirect => "HTTP connection".to_string(), RunnerError::TooManyRedirect => "HTTP connection".to_string(),
RunnerError::UnauthorizedFileAccess { .. } => "Unauthorized file access".to_string(), RunnerError::UnauthorizedFileAccess { .. } => "Unauthorized file access".to_string(),
RunnerError::UnrenderableVariable { .. } => "Unrenderable variable".to_string(), RunnerError::UnrenderableVariable { .. } => "Unrenderable variable".to_string(),
@ -188,12 +169,9 @@ impl hurl_core::error::Error for Error {
RunnerError::AssertStatus { actual, .. } => format!("actual value is <{actual}>"), RunnerError::AssertStatus { actual, .. } => format!("actual value is <{actual}>"),
RunnerError::AssertVersion { actual, .. } => format!("actual value is <{actual}>"), RunnerError::AssertVersion { actual, .. } => format!("actual value is <{actual}>"),
RunnerError::CouldNotParseResponse => "could not parse response".to_string(), RunnerError::CouldNotParseResponse => "could not parse response".to_string(),
RunnerError::CouldNotResolveHost(host) => format!("could not resolve host <{host}>"),
RunnerError::CouldNotResolveProxyName => "could not resolve proxy name".to_string(),
RunnerError::CouldNotUncompressResponse(algorithm) => { RunnerError::CouldNotUncompressResponse(algorithm) => {
format!("could not uncompress response with {algorithm}") format!("could not uncompress response with {algorithm}")
} }
RunnerError::FailToConnect => "fail to connect".to_string(),
RunnerError::FileReadAccess { value } => format!("file {value} can not be read"), RunnerError::FileReadAccess { value } => format!("file {value} can not be read"),
RunnerError::FilterDecode(encoding) => { RunnerError::FilterDecode(encoding) => {
format!("value can not be decoded with <{encoding}> encoding") format!("value can not be decoded with <{encoding}> encoding")
@ -205,7 +183,6 @@ impl hurl_core::error::Error for Error {
format!("invalid filter input: {message}") format!("invalid filter input: {message}")
} }
RunnerError::FilterMissingInput => "missing value to apply filter".to_string(), RunnerError::FilterMissingInput => "missing value to apply filter".to_string(),
RunnerError::FilterRegexNoCapture => "capture not found".to_string(),
RunnerError::HttpConnection(message) => message.to_string(), RunnerError::HttpConnection(message) => message.to_string(),
RunnerError::InvalidCharset { charset } => { RunnerError::InvalidCharset { charset } => {
format!("the charset '{charset}' is not valid") format!("the charset '{charset}' is not valid")
@ -222,15 +199,6 @@ impl hurl_core::error::Error for Error {
format!("URL <{url}> must start with http:// or https://") format!("URL <{url}> must start with http:// or https://")
} }
RunnerError::NoQueryResult => "The query didn't return any result".to_string(), RunnerError::NoQueryResult => "The query didn't return any result".to_string(),
RunnerError::PredicateType => {
"predicate type inconsistent with value return by query".to_string()
}
RunnerError::PredicateValue(value) => {
format!("actual value is <{value}>")
}
RunnerError::QueryCookieNotFound => {
"this cookie has not been found in the response".to_string()
}
RunnerError::QueryHeaderNotFound => { RunnerError::QueryHeaderNotFound => {
"this header has not been found in the response".to_string() "this header has not been found in the response".to_string()
} }
@ -240,7 +208,6 @@ impl hurl_core::error::Error for Error {
} }
RunnerError::QueryInvalidXml => "the HTTP response is not a valid XML".to_string(), RunnerError::QueryInvalidXml => "the HTTP response is not a valid XML".to_string(),
RunnerError::QueryInvalidXpathEval => "the XPath expression is not valid".to_string(), RunnerError::QueryInvalidXpathEval => "the XPath expression is not valid".to_string(),
RunnerError::SslCertificate(description) => description.clone(),
RunnerError::TemplateVariableInvalidType { RunnerError::TemplateVariableInvalidType {
value, expecting, .. value, expecting, ..
} => { } => {
@ -249,7 +216,6 @@ impl hurl_core::error::Error for Error {
RunnerError::TemplateVariableNotDefined { name } => { RunnerError::TemplateVariableNotDefined { name } => {
format!("you must set the variable {name}") format!("you must set the variable {name}")
} }
RunnerError::Timeout => "timeout has been reached".to_string(),
RunnerError::TooManyRedirect => "too many redirect".to_string(), RunnerError::TooManyRedirect => "too many redirect".to_string(),
RunnerError::UnauthorizedFileAccess { path } => { RunnerError::UnauthorizedFileAccess { path } => {
format!( format!(