Skip to content

Commit

Permalink
(wip) debug
Browse files Browse the repository at this point in the history
  • Loading branch information
pnmadelaine committed Sep 25, 2023
1 parent 0d9a368 commit c7e34c9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 1 addition & 3 deletions typhon/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,7 @@ async fn webhook(
.webhook(input)
.await
.map_err(|e| {
if e.is_internal() {
log::error!("webhook raised error: {:?}", e);
}
log::error!("webhook raised error: {:?}", e);
ResponseErrorWrapper(e.into())
})?
.into_iter();
Expand Down
4 changes: 3 additions & 1 deletion typhon/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub enum Error {
Todo,
UnexpectedDatabaseError(diesel::result::Error),
LoginError,
WebhookError(String),
}

impl Error {
Expand Down Expand Up @@ -71,6 +72,7 @@ impl std::fmt::Display for Error {
LoginError => write!(f, "Login error"),
Todo => write!(f, "Unspecified error"),
UnexpectedDatabaseError(e) => write!(f, "Database error: {}", e),
WebhookError(e) => write!(f, "Webhook error: {}", e),
}
}
}
Expand Down Expand Up @@ -113,7 +115,7 @@ impl Into<typhon_types::responses::ResponseError> for Error {
| ProjectAlreadyExists(_)
| LoginError
| LogNotFound(_) => BadRequest(format!("{}", self)),
Todo | UnexpectedDatabaseError(_) => InternalError,
Todo | UnexpectedDatabaseError(_) | WebhookError(_) => InternalError,
}
}
}
6 changes: 3 additions & 3 deletions typhon/src/projects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,15 +263,15 @@ impl Project {
Some(path) => {
if Path::new(&format!("{}/webhook", path)).exists() {
let action_input = serde_json::to_value(input).unwrap();
let (action_output, _) = actions::run(
let (action_output, logs) = actions::run(
&self.project_key,
&format!("{}/webhook", path),
&format!("{}/secrets", path),
&action_input,
)
.await?;
let commands: actions::webhooks::Output =
serde_json::from_str(&action_output).map_err(|_| Error::Todo)?;
let commands: actions::webhooks::Output = serde_json::from_str(&action_output)
.map_err(|_| Error::WebhookError(logs))?;
Ok(commands
.into_iter()
.map(|cmd| cmd.lift(self.handle()))
Expand Down

0 comments on commit c7e34c9

Please sign in to comment.