Skip to content

Commit

Permalink
Merge pull request #11 from gibbz00/ws_error_other
Browse files Browse the repository at this point in the history
Report error rather than panicking with `unreachable!`
  • Loading branch information
najamelan authored Feb 4, 2025
2 parents 4035d46 + 278e763 commit c70551f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ pub enum WsErr
#[ error( "Received a message that is neither ArrayBuffer, String or Blob." ) ]
//
UnknownDataType,

/// Fallback whenever explicit variant hadling hansn't yet been implemented.
#[error("`{0}`")]
//
Other(String),
}


2 changes: 1 addition & 1 deletion src/ws_meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ impl WsMeta
return Err( WsErr::InvalidUrl{ supplied: url.as_ref().to_string() } ),


_ => unreachable!(),
_ => return Err(WsErr::Other(de.message())),
};
}
};
Expand Down

0 comments on commit c70551f

Please sign in to comment.