-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
NetworkError::Internal should use an enum instead of a string #36434
Copy link
Copy link
Closed
Description
Code like
servo/components/script/dom/eventsource.rs
Lines 362 to 365 in a0730d7
| // The spec advises failing here if reconnecting would be | |
| // "futile", with no more specific advice; WPT tests | |
| // consider a non-http(s) scheme to be futile. | |
| match self.event_source.root().url.scheme() { |
is_permanent_failure), rather than simply containing a user-readable string. We could move the strings to a Debug implementation on the enum instead.
servo/components/shared/net/lib.rs
Lines 912 to 913 in a0730d7
| /// Could be any of the internal errors, like unsupported scheme, connection errors, etc. | |
| Internal(String), |
However, code like
servo/components/shared/net/lib.rs
Lines 926 to 932 in a0730d7
| _ => NetworkError::Internal(error_string), | |
| } | |
| } | |
| pub fn from_http_error(error: &HttpError) -> Self { | |
| NetworkError::Internal(error.to_string()) | |
| } |
Reactions are currently unavailable