Handle errors in push events.
This commit is contained in:
parent
dd4c20f0a7
commit
753ad6dd05
@ -42,21 +42,29 @@ pub(crate) async fn hook(
|
||||
debug!("REQ: {:?}", payload);
|
||||
match payload {
|
||||
HookRequest::Push(webhook_payload) => {
|
||||
handle_push(
|
||||
let push_result = handle_push(
|
||||
state.gitea,
|
||||
state.kubernetes_client,
|
||||
state.allowed_repos.borrow(),
|
||||
webhook_payload,
|
||||
)
|
||||
.await
|
||||
.expect("Failed to handle push event.");
|
||||
(
|
||||
StatusCode::OK,
|
||||
Json(HookResponse {
|
||||
ok: true,
|
||||
message: None,
|
||||
}),
|
||||
)
|
||||
.await;
|
||||
match push_result {
|
||||
Ok(_) => (
|
||||
StatusCode::OK,
|
||||
Json(HookResponse {
|
||||
ok: true,
|
||||
message: None,
|
||||
}),
|
||||
),
|
||||
Err(_) => (
|
||||
StatusCode::INTERNAL_SERVER_ERROR,
|
||||
Json(HookResponse {
|
||||
ok: false,
|
||||
message: Some(format!("Failed to handle push event.")),
|
||||
}),
|
||||
),
|
||||
}
|
||||
}
|
||||
HookRequest::Unrecognized(payload) => (
|
||||
StatusCode::BAD_REQUEST,
|
||||
|
Loading…
x
Reference in New Issue
Block a user