blob: 46564c3700d5e94eb13fdc9074a496a05538aed8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
//! ref: composer/vendor/symfony/process/Exception/ProcessTimedOutException.php
use crate::symfony::process::process::Process;
#[derive(Debug)]
pub struct ProcessTimedOutException {
pub message: String,
pub code: i64,
}
impl ProcessTimedOutException {
pub fn new(process: &Process) -> Self {
let exceeded_timeout = process.get_timeout();
let message = format!(
"The process \"{}\" exceeded the timeout of {} seconds.",
process.get_command_line(),
exceeded_timeout.map(|t| t.to_string()).unwrap_or_default(),
);
Self { message, code: 0 }
}
}
impl std::fmt::Display for ProcessTimedOutException {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.message)
}
}
impl std::error::Error for ProcessTimedOutException {}
|