Skip to content

Commit

Permalink
refactor(core, utils): updated commands.rs and error.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
omarabid committed Feb 4, 2024
1 parent b51db57 commit dd90c5c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,11 @@ pub fn helpme() -> Result<()> {
let returned_command = response
.choices
.first()
.ok_or_else(|| GitonError::new("No choices returned"))?
.ok_or_else(|| GitonError::EmptyResponse(String::from("No choices returned")))?
.message
.content
.as_ref()
.ok_or_else(|| GitonError::new("No content returned"))?;
.ok_or_else(|| GitonError::EmptyResponse(String::from("No content returned")))?;

dbg!(returned_command);

Expand Down
2 changes: 2 additions & 0 deletions utils/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ pub enum GitonError {
},
#[error("Decode Error: {0}")]
DecodeResponse(String),
#[error("Empty Response: {0}")]
EmptyResponse(String),
#[error("IO Error")]
Io(#[from] std::io::Error),
#[error("Config Error")]
Expand Down

0 comments on commit dd90c5c

Please sign in to comment.