Noted inaccuracies of the is_error function for Response.

This commit is contained in:
Aaron Weiss 2018-02-07 12:13:43 +01:00
parent 31f8c692b6
commit decfd0b9bc
No known key found for this signature in database
GPG key ID: 047D32DF25DC22EF

View file

@ -408,6 +408,10 @@ make_response! {
impl Response { impl Response {
/// Determines whether or not this response is an error response. /// Determines whether or not this response is an error response.
///
/// This error consideration is according to RFC2812, but is rather simplistic. It considers all
/// response codes above 400 to be errors, which misclassifies some extensions (e.g. from IRCv3)
/// that add responses and errors both in the same range (typically 700s or 900s).
pub fn is_error(&self) -> bool { pub fn is_error(&self) -> bool {
*self as u16 >= 400 *self as u16 >= 400
} }