Skip to content

Commit

Permalink
Fix typo in ConversionError
Browse files Browse the repository at this point in the history
Co-Authored-By: Paul Horn <dev@knutwalker.engineer>
  • Loading branch information
s1ck and knutwalker committed Feb 16, 2023
1 parent 180b5e0 commit 4dc2788
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 27 deletions.
38 changes: 19 additions & 19 deletions lib/src/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ impl TryFrom<BoltType> for f64 {
fn try_from(input: BoltType) -> Result<f64> {
match input {
BoltType::Float(t) => Ok(t.value),
_ => Err(Error::ConverstionError),
_ => Err(Error::ConversionError),
}
}
}
Expand All @@ -20,7 +20,7 @@ impl TryFrom<BoltType> for i64 {
fn try_from(input: BoltType) -> Result<i64> {
match input {
BoltType::Integer(t) => Ok(t.value),
_ => Err(Error::ConverstionError),
_ => Err(Error::ConversionError),
}
}
}
Expand All @@ -31,7 +31,7 @@ impl TryFrom<BoltType> for bool {
fn try_from(input: BoltType) -> Result<bool> {
match input {
BoltType::Boolean(t) => Ok(t.value),
_ => Err(Error::ConverstionError),
_ => Err(Error::ConversionError),
}
}
}
Expand All @@ -42,7 +42,7 @@ impl TryFrom<BoltType> for Point2D {
fn try_from(input: BoltType) -> Result<Point2D> {
match input {
BoltType::Point2D(p) => Ok(Point2D::new(p)),
_ => Err(Error::ConverstionError),
_ => Err(Error::ConversionError),
}
}
}
Expand All @@ -53,7 +53,7 @@ impl TryFrom<BoltType> for std::time::Duration {
fn try_from(input: BoltType) -> Result<std::time::Duration> {
match input {
BoltType::Duration(d) => Ok(d.into()),
_ => Err(Error::ConverstionError),
_ => Err(Error::ConversionError),
}
}
}
Expand All @@ -64,7 +64,7 @@ impl TryFrom<BoltType> for chrono::NaiveDate {
fn try_from(input: BoltType) -> Result<chrono::NaiveDate> {
match input {
BoltType::Date(d) => d.try_into(),
_ => Err(Error::ConverstionError),
_ => Err(Error::ConversionError),
}
}
}
Expand All @@ -75,7 +75,7 @@ impl TryFrom<BoltType> for chrono::DateTime<chrono::FixedOffset> {
fn try_from(input: BoltType) -> Result<chrono::DateTime<chrono::FixedOffset>> {
match input {
BoltType::DateTime(d) => d.try_into(),
_ => Err(Error::ConverstionError),
_ => Err(Error::ConversionError),
}
}
}
Expand All @@ -86,7 +86,7 @@ impl TryFrom<BoltType> for chrono::NaiveDateTime {
fn try_from(input: BoltType) -> Result<chrono::NaiveDateTime> {
match input {
BoltType::LocalDateTime(d) => d.try_into(),
_ => Err(Error::ConverstionError),
_ => Err(Error::ConversionError),
}
}
}
Expand All @@ -105,7 +105,7 @@ impl TryFrom<BoltType> for (chrono::NaiveTime, Option<chrono::FixedOffset>) {
}
}
BoltType::LocalTime(d) => Ok((d.into(), None)),
_ => Err(Error::ConverstionError),
_ => Err(Error::ConversionError),
}
}
}
Expand All @@ -116,7 +116,7 @@ impl TryFrom<BoltType> for (chrono::NaiveDateTime, String) {
fn try_from(input: BoltType) -> Result<(chrono::NaiveDateTime, String)> {
match input {
BoltType::DateTimeZoneId(date_time_zone_id) => date_time_zone_id.try_into(),
_ => Err(Error::ConverstionError),
_ => Err(Error::ConversionError),
}
}
}
Expand All @@ -127,7 +127,7 @@ impl TryFrom<BoltType> for Vec<u8> {
fn try_from(input: BoltType) -> Result<Vec<u8>> {
match input {
BoltType::Bytes(b) => Ok(b.value.to_vec()),
_ => Err(Error::ConverstionError),
_ => Err(Error::ConversionError),
}
}
}
Expand All @@ -138,7 +138,7 @@ impl TryFrom<BoltType> for Point3D {
fn try_from(input: BoltType) -> Result<Point3D> {
match input {
BoltType::Point3D(p) => Ok(Point3D::new(p)),
_ => Err(Error::ConverstionError),
_ => Err(Error::ConversionError),
}
}
}
Expand All @@ -149,7 +149,7 @@ impl TryFrom<BoltType> for Node {
fn try_from(input: BoltType) -> Result<Node> {
match input {
BoltType::Node(n) => Ok(Node::new(n)),
_ => Err(Error::ConverstionError),
_ => Err(Error::ConversionError),
}
}
}
Expand All @@ -160,7 +160,7 @@ impl TryFrom<BoltType> for Path {
fn try_from(input: BoltType) -> Result<Path> {
match input {
BoltType::Path(n) => Ok(Path::new(n)),
_ => Err(Error::ConverstionError),
_ => Err(Error::ConversionError),
}
}
}
Expand All @@ -171,7 +171,7 @@ impl TryFrom<BoltType> for Relation {
fn try_from(input: BoltType) -> Result<Relation> {
match input {
BoltType::Relation(r) => Ok(Relation::new(r)),
_ => Err(Error::ConverstionError),
_ => Err(Error::ConversionError),
}
}
}
Expand All @@ -182,7 +182,7 @@ impl TryFrom<BoltType> for UnboundedRelation {
fn try_from(input: BoltType) -> Result<UnboundedRelation> {
match input {
BoltType::UnboundedRelation(r) => Ok(UnboundedRelation::new(r)),
_ => Err(Error::ConverstionError),
_ => Err(Error::ConversionError),
}
}
}
Expand All @@ -192,7 +192,7 @@ impl TryFrom<BoltType> for BoltList {
fn try_from(input: BoltType) -> Result<BoltList> {
match input {
BoltType::List(l) => Ok(l),
_ => Err(Error::ConverstionError),
_ => Err(Error::ConversionError),
}
}
}
Expand All @@ -202,7 +202,7 @@ impl TryFrom<BoltType> for BoltString {
fn try_from(input: BoltType) -> Result<BoltString> {
match input {
BoltType::String(s) => Ok(s),
_ => Err(Error::ConverstionError),
_ => Err(Error::ConversionError),
}
}
}
Expand All @@ -212,7 +212,7 @@ impl TryFrom<BoltType> for String {
fn try_from(input: BoltType) -> Result<String> {
match input {
BoltType::String(t) => Ok(t.value),
_ => Err(Error::ConverstionError),
_ => Err(Error::ConversionError),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub enum Error {
UnexpectedMessage(String),
UnknownType(String),
UnknownMessage(String),
ConverstionError,
ConversionError,
AuthenticationError(String),
InvalidTypeMarker(String),
DeserializationError(String),
Expand Down
4 changes: 1 addition & 3 deletions lib/src/types/date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ impl TryInto<NaiveDate> for BoltDate {
fn try_into(self) -> Result<NaiveDate> {
let epoch = NaiveDate::from_ymd_opt(1970, 1, 1).unwrap();
let days = Duration::days(self.days.value);
epoch
.checked_add_signed(days)
.ok_or(Error::ConverstionError)
epoch.checked_add_signed(days).ok_or(Error::ConversionError)
}
}

Expand Down
8 changes: 4 additions & 4 deletions lib/src/types/date_time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl TryInto<(NaiveDateTime, String)> for BoltDateTimeZoneId {
fn try_into(self) -> Result<(NaiveDateTime, String)> {
NaiveDateTime::from_timestamp_opt(self.seconds.value, self.nanoseconds.value as u32)
.map(|datetime| (datetime, self.tz_id.into()))
.ok_or(Error::ConverstionError)
.ok_or(Error::ConversionError)
}
}

Expand All @@ -66,7 +66,7 @@ impl TryInto<NaiveDateTime> for BoltLocalDateTime {

fn try_into(self) -> Result<NaiveDateTime> {
NaiveDateTime::from_timestamp_opt(self.seconds.value, self.nanoseconds.value as u32)
.ok_or(Error::ConverstionError)
.ok_or(Error::ConversionError)
}
}

Expand All @@ -90,9 +90,9 @@ impl TryInto<DateTime<FixedOffset>> for BoltDateTime {
fn try_into(self) -> Result<DateTime<FixedOffset>> {
let seconds = self.seconds.value - self.tz_offset_seconds.value;
let offset = FixedOffset::east_opt(self.tz_offset_seconds.value as i32)
.ok_or(Error::ConverstionError)?;
.ok_or(Error::ConversionError)?;
let datetime = NaiveDateTime::from_timestamp_opt(seconds, self.nanoseconds.value as u32)
.ok_or(Error::ConverstionError)?;
.ok_or(Error::ConversionError)?;

Ok(DateTime::from_utc(datetime, offset))
}
Expand Down

0 comments on commit 4dc2788

Please sign in to comment.