-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handling Errors in a proper trait, and passing it up the stack
- Loading branch information
1 parent
823f3d7
commit 5e20ce4
Showing
31 changed files
with
406 additions
and
257 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
use crate::types::model::deployment::Deployment; | ||
use crate::business::repositories; | ||
use crate::types::model::deployment::Deployment; | ||
use crate::types::other::voyager_error::VoyagerError; | ||
|
||
|
||
pub async fn get(id: String) -> Option<Deployment> { | ||
pub async fn get(id: String) -> Result<Deployment, VoyagerError> { | ||
repositories::deployments::find_by_id(id).await | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
use crate::business::repositories; | ||
use crate::modules::docker; | ||
use crate::types::other::voyager_error::VoyagerError; | ||
|
||
pub async fn get_logs(id: String) -> Result<Vec<String>, VoyagerError> { | ||
let deployment = repositories::deployments::find_by_id(id).await?; | ||
|
||
pub async fn get_logs(id: String) -> Option<Vec<String>> { | ||
if let Some(deployment) = repositories::deployments::find_by_id(id).await { | ||
return docker::get_logs(&deployment.container_name).await | ||
} | ||
|
||
None | ||
docker::get_logs(&deployment.container_name).await | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
use crate::{business::repositories, types::model::deployment::Deployment}; | ||
use crate::{ | ||
business::repositories, | ||
types::{model::deployment::Deployment, other::voyager_error::VoyagerError}, | ||
}; | ||
|
||
|
||
pub async fn list(repo_url: Option<String>, branch: Option<String>) -> Option<Vec<Deployment>> { | ||
pub async fn list( | ||
repo_url: Option<String>, | ||
branch: Option<String>, | ||
) -> Result<Vec<Deployment>, VoyagerError> { | ||
repositories::deployments::retrieve_all(repo_url, branch).await | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.