Skip to content

Commit

Permalink
refactor: make ErrorObject::borrowed accept &str (#1160)
Browse files Browse the repository at this point in the history
* make ErrorObject::borrowed accept DST message type

* Update types/src/error.rs

* Update types/src/error.rs

---------

Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
  • Loading branch information
aj3n and niklasad1 authored Aug 10, 2023
1 parent ad9dab3 commit 1045057
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions types/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ impl<'a> ErrorObject<'a> {
}

/// Create a new [`ErrorObject`] with optional data.
pub fn borrowed(code: i32, message: &'a impl AsRef<str>, data: Option<&'a RawValue>) -> ErrorObject<'a> {
ErrorObject { code: code.into(), message: StdCow::Borrowed(message.as_ref()), data: data.map(StdCow::Borrowed) }
pub fn borrowed(code: i32, message: &'a str, data: Option<&'a RawValue>) -> ErrorObject<'a> {
ErrorObject { code: code.into(), message: StdCow::Borrowed(message), data: data.map(StdCow::Borrowed) }
}

/// Take ownership of the parameters within, if we haven't already.
Expand Down

0 comments on commit 1045057

Please sign in to comment.