Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Commit

Permalink
feat: add api_error message fn
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleymichal committed Aug 5, 2019
1 parent cd0885a commit d81bc7c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/terminal/message.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use super::emoji;
use cloudflare::response::APIError;

fn message(msg: &str) {
println!("{}", msg);
Expand Down Expand Up @@ -38,3 +39,12 @@ pub fn help(msg: &str) {
let msg = format!("{} {}", emoji::SLEUTH, msg);
message(&msg);
}

pub fn api_error(error: APIError, suggested_action: String) {
let msg = format!(
"Error {}: {}\n{}",
error.code, error.message, suggested_action
);

message(&msg);
}

0 comments on commit d81bc7c

Please sign in to comment.