Revert "commitstatus: return an error if we fail to set a status"
This reverts commit 0ae112f976
.
This commit is contained in:
parent
0ae112f976
commit
cf28b411f2
|
@ -36,25 +36,18 @@ impl<'a> CommitStatus<'a> {
|
||||||
self.url = url.unwrap_or_else(|| String::from(""))
|
self.url = url.unwrap_or_else(|| String::from(""))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_with_description(
|
pub fn set_with_description(&mut self, description: &str, state: hubcaps::statuses::State) {
|
||||||
&mut self,
|
|
||||||
description: &str,
|
|
||||||
state: hubcaps::statuses::State,
|
|
||||||
) -> Result<(), CommitStatusError> {
|
|
||||||
self.set_description(description.to_owned());
|
self.set_description(description.to_owned());
|
||||||
self.set(state)
|
self.set(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_description(&mut self, description: String) {
|
pub fn set_description(&mut self, description: String) {
|
||||||
self.description = description;
|
self.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set(&self, state: hubcaps::statuses::State) -> Result<(), CommitStatusError> {
|
pub fn set(&self, state: hubcaps::statuses::State) {
|
||||||
let desc = if self.description.len() >= 140 {
|
let desc = if self.description.len() >= 140 {
|
||||||
eprintln!(
|
eprintln!("Warning: description is over 140 char; truncating: {:?}", &self.description);
|
||||||
"Warning: description is over 140 char; truncating: {:?}",
|
|
||||||
&self.description
|
|
||||||
);
|
|
||||||
self.description.chars().take(140).collect()
|
self.description.chars().take(140).collect()
|
||||||
} else {
|
} else {
|
||||||
self.description.clone()
|
self.description.clone()
|
||||||
|
@ -69,11 +62,6 @@ impl<'a> CommitStatus<'a> {
|
||||||
.target_url(self.url.clone())
|
.target_url(self.url.clone())
|
||||||
.build(),
|
.build(),
|
||||||
)
|
)
|
||||||
.map(|_| ())
|
.expect("Failed to mark final status on commit");
|
||||||
.map_err(|e| CommitStatusError::HubcapsError(e))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum CommitStatusError {
|
|
||||||
HubcapsError(hubcaps::Error),
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue