mirror of
https://github.com/servo/servo
synced 2026-04-26 01:25:32 +02:00
Replace NetworkError::Internal with structured enum variants for calls with literal strings (#36599)
Replace NetworkError::Internal with structured enum variants - Adds UnsupportedScheme,CorsViolation,ConnectionFailure,Timeout,RedirectError,InvalidMethod,ResourceError,SecurityBlock,MixedContent,CacheError,InvalidPort, LocalDirectoryError, variants in NetworkError enum. - Refactored the usage of NetworkError::Internal(String) to use the appropriate new variant Testing: Changes does not require test. Fixes: https://github.com/servo/servo/issues/36434 --------- Signed-off-by: Uthman Yahaya Baba <uthmanyahayababa@gmail.com> Signed-off-by: Usman Yahaya Baba <91813795+uthmaniv@users.noreply.github.com> Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com> Co-authored-by: Tim van der Lippe <tvanderlippe@gmail.com>
This commit is contained in:
committed by
GitHub
parent
df9877a94c
commit
6decaaefa9
@@ -353,13 +353,13 @@ impl FetchResponseListener for ClassicContext {
|
||||
|
||||
self.status = {
|
||||
if status.is_error() {
|
||||
Err(NetworkError::Internal(
|
||||
Err(NetworkError::ResourceLoadError(
|
||||
"No http status code received".to_owned(),
|
||||
))
|
||||
} else if status.is_success() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(NetworkError::Internal(format!(
|
||||
Err(NetworkError::ResourceLoadError(format!(
|
||||
"HTTP error code {}",
|
||||
status.code()
|
||||
)))
|
||||
|
||||
Reference in New Issue
Block a user