- failwith (sprintf "koji_build_state_task: %s: no such build" verrel);
- let state =
- try
- let subs = Pcre.exec ~rex:state out in
- match Pcre.get_substring subs 1 with
- | "BUILDING" -> `Building
- | "COMPLETE" -> `Complete
- | "DELETED" -> `Deleted
- | "FAILED" -> `Failed
- | "CANCELED" -> `Canceled
- | sub ->
- failwith (sprintf "koji_build_state_task: %s: unknown build state '%s'"
- verrel sub)
- with
- Not_found ->
- failwith (sprintf "koji_build_state_task: %s: no build state found"
- verrel) in
- let task =
- try
- let subs = Pcre.exec ~rex:task_id out in
- Some (int_of_string (Pcre.get_substring subs 1))
- with
- Not_found -> None in
-
- if state == `Complete then
- memory_set key "1";
-
- state, task
+ `No_such_build, None
+ else (
+ let state =
+ try
+ let subs = Pcre.exec ~rex:state out in
+ match Pcre.get_substring subs 1 with
+ | "BUILDING" -> `Building
+ | "COMPLETE" -> `Complete
+ | "DELETED" -> `Deleted
+ | "FAILED" -> `Failed
+ | "CANCELED" -> `Canceled
+ | sub ->
+ failwith (sprintf "koji_build_state_task: %s: unknown build state '%s'"
+ verrel sub)
+ with
+ Not_found ->
+ failwith (sprintf "koji_build_state_task: %s: no build state found"
+ verrel) in
+ let task =
+ try
+ let subs = Pcre.exec ~rex:task_id out in
+ Some (int_of_string (Pcre.get_substring subs 1))
+ with
+ Not_found -> None in
+
+ if state == `Complete then
+ memory_set key "1";
+
+ state, task
+ )