Skip to content

Commit

Permalink
improve error msg on timeout opening stream
Browse files Browse the repository at this point in the history
Before, it'd look like the following, as mentioned in
#331:

```
2024-12-09T20:53:24.853572 WARN s-CP3PRO-main streamer{stream="CP3PRO-main"}: moonfire_nvr::streamer: sleeping for 1 s after error err=UNKNOWN
caused by: deadline has elapsed
```

...which isn't as clear as it could be, particularly if you don't notice
the `caused by` bit. After, it should look more like the following:

```
2024-12-09T20:53:24.853572 WARN s-CP3PRO-main streamer{stream="CP3PRO-main"}: moonfire_nvr::streamer: sleeping for 1 s after error err=DEADLINE_EXCEEDED unable to play stream and get first frame within PT30S
caused by: deadline has elapsed
```
  • Loading branch information
scottlamb committed Dec 11, 2024
1 parent 9256561 commit 904842c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ even on minor releases, e.g. `v0.7.5` -> `v0.7.6`.
## unreleased

* bump minimum Rust version to 1.81.
* improve error message on timeout opening stream.

## v0.7.17 (2024-09-03)

Expand Down
10 changes: 8 additions & 2 deletions server/src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,13 @@ impl Opener for RealOpener {
),
)
.expect("RetinaStream::play task panicked, see earlier error")
.map_err(|e| err!(Unknown, source(e)))??;
.map_err(|e| {
err!(
DeadlineExceeded,
msg("unable to play stream and get first frame within {RETINA_TIMEOUT:?}"),
source(e),
)
})??;
Ok(Box::new(RetinaStream {
inner: Some(inner),
rt_handle,
Expand Down Expand Up @@ -302,7 +308,7 @@ impl Stream for RetinaStream {
.map_err(|e| {
err!(
DeadlineExceeded,
msg("timeout getting next frame"),
msg("unable to get next frame within {RETINA_TIMEOUT:?}"),
source(e)
)
})??;
Expand Down

0 comments on commit 904842c

Please sign in to comment.