mirror of
https://github.com/vale981/stream
synced 2025-03-05 10:01:39 -05:00
add simple error diagnose
This commit is contained in:
parent
4da9c88ff7
commit
4bd265a246
1 changed files with 36 additions and 0 deletions
|
@ -77,6 +77,42 @@
|
||||||
(recur)
|
(recur)
|
||||||
id))))
|
id))))
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
; Error Diagnose ;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(defn diagnose-error
|
||||||
|
"Deduces the problem from the error `message` and the process
|
||||||
|
information `proc` and returns it.
|
||||||
|
|
||||||
|
The returned codes are:
|
||||||
|
`:source` The streaming source can't be reached.
|
||||||
|
`:remote` The streaming remote can't be reached.
|
||||||
|
`:os` Launching the process failed at the os level.
|
||||||
|
Executable not found or something else.
|
||||||
|
Most likely not recoverable.
|
||||||
|
`:user` The user killed the process. This ain't an error.
|
||||||
|
`:unknown` The catchall."
|
||||||
|
[message proc]
|
||||||
|
(cond
|
||||||
|
(string/includes? message (:cam-ip (:ffmpeg-config proc)))
|
||||||
|
:source
|
||||||
|
|
||||||
|
(or (re-find #"Operation not permitted" message)
|
||||||
|
(re-find #"Input/output" message)
|
||||||
|
(string/includes? message (:stream-server (:ffmpeg-config proc))))
|
||||||
|
:remote
|
||||||
|
|
||||||
|
(or (re-find #"spawn" message)
|
||||||
|
(re-find #"niceness" message))
|
||||||
|
:os
|
||||||
|
|
||||||
|
(or (re-find #"SIGINT" message)
|
||||||
|
(re-find #"SIGKILL" message))
|
||||||
|
:user
|
||||||
|
|
||||||
|
:else :unknown))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; Monitoring ;
|
; Monitoring ;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
Loading…
Add table
Reference in a new issue