summaryrefslogtreecommitdiffstats
path: root/src/endpoint/error.rs
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2020-11-15 11:45:13 +0100
committerMatthias Beyer <mail@beyermatthias.de>2020-11-15 11:46:32 +0100
commite703284a2afa1ff9b9115e8101b462a5f1accd2a (patch)
tree9343b93eebdeafbc1643104535d9bedd835f694f /src/endpoint/error.rs
parent771f957d4202bfa15820dc004b9cb874a32b7746 (diff)
Add URI reporting
This patch adds the URI to the container error error-message. The URI is required, of course, to connect to the remote docker container if there was an error. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src/endpoint/error.rs')
-rw-r--r--src/endpoint/error.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/endpoint/error.rs b/src/endpoint/error.rs
index a6a6d7b..e04ee51 100644
--- a/src/endpoint/error.rs
+++ b/src/endpoint/error.rs
@@ -9,6 +9,7 @@ pub enum ContainerError {
#[error("Error during container run: {container_id}")]
ContainerError {
container_id: ContainerHash,
+ uri: String,
},
#[error("{0}")]
@@ -16,21 +17,23 @@ pub enum ContainerError {
}
impl ContainerError {
- pub fn container_error(container_id: ContainerHash) -> Self {
- ContainerError::ContainerError { container_id }
+ pub fn container_error(container_id: ContainerHash, uri: String) -> Self {
+ ContainerError::ContainerError { container_id, uri }
}
pub fn explain_container_error(&self) -> Option<String> {
match self {
- ContainerError::ContainerError { container_id } => Some({
+ ContainerError::ContainerError { container_id, uri } => Some({
indoc::formatdoc!(r#"
Container did not exit successfully: {container_id}
+ It was not stopped because of this.
+
Use
- docker exec -it {container_id} /bin/bash
+ docker --host {uri} exec -it {container_id} /bin/bash
to access and debug.
- "#, container_id = container_id)
+ "#, uri = uri, container_id = container_id)
}),
_ => None,
}