File tree 1 file changed +8
-4
lines changed
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -872,19 +872,23 @@ fn stream_timestamp(
872
872
let ts = status. get_htstamp ( ) ;
873
873
let nanos = timespec_diff_nanos ( ts, trigger_ts) ;
874
874
if nanos < 0 {
875
- panic ! (
875
+ let description = format ! (
876
876
"get_htstamp `{}.{}` was earlier than get_trigger_htstamp `{}.{}`" ,
877
877
ts. tv_sec, ts. tv_nsec, trigger_ts. tv_sec, trigger_ts. tv_nsec
878
878
) ;
879
+ return Err ( BackendSpecificError { description } ) ;
879
880
}
880
881
Ok ( crate :: StreamInstant :: from_nanos ( nanos) )
881
882
}
882
883
Some ( creation) => {
883
884
let now = std:: time:: Instant :: now ( ) ;
884
885
let duration = now. duration_since ( creation) ;
885
- let instant = crate :: StreamInstant :: from_nanos_i128 ( duration. as_nanos ( ) as i128 )
886
- . expect ( "stream duration has exceeded `StreamInstant` representation" ) ;
887
- Ok ( instant)
886
+ crate :: StreamInstant :: from_nanos_i128 ( duration. as_nanos ( ) as i128 ) . ok_or (
887
+ BackendSpecificError {
888
+ description : "stream duration has exceeded `StreamInstant` representation"
889
+ . to_string ( ) ,
890
+ } ,
891
+ )
888
892
}
889
893
}
890
894
}
You can’t perform that action at this time.
0 commit comments