Skip to content

Commit aac7fc3

Browse files
committed
chore: add comment
1 parent 1f4c278 commit aac7fc3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

rust/cubesql/pg-srv/src/values/timestamp.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use chrono::{
1111
prelude::*,
1212
};
1313
use chrono_tz::Tz;
14+
use std::io::Error;
1415
use std::{
1516
fmt::{self, Debug, Display, Formatter},
1617
io,
@@ -122,10 +123,14 @@ impl ToProtocolValue for TimestampValue {
122123
None => self.to_naive_datetime(),
123124
Some(_) => self.to_fixed_datetime()?.naive_utc(),
124125
};
126+
125127
let n = ndt
126128
.signed_duration_since(pg_base_date_epoch())
127129
.num_microseconds()
128-
.unwrap();
130+
.ok_or(Error::new(
131+
io::ErrorKind::Other,
132+
"Unable to extract number of seconds from timestamp",
133+
))?;
129134

130135
buf.put_i32(8);
131136
buf.put_i64(n);

0 commit comments

Comments
 (0)