Add clock drift error messages to 14 more implementations
When timestamp auth fails (401 with timestamp in error), show helpful message: - Error: Request timestamp expired (must be within 5 minutes of server time) - Your computer's clock may have drifted. - NTP sync commands for Linux/macOS/Windows Updated: un.awk, un.cpp, un.cr, un.d, un.dart, un.groovy, un.jl, un.kt, un.nim, un.ps1, un.rs, un.tcl, un.ts, un.v
This commit is contained in:
parent
ae8f9ee8c8
commit
bc0da08a08
14 changed files with 168 additions and 9 deletions
15
un.rs
15
un.rs
|
|
@ -228,7 +228,20 @@ fn api_request(endpoint: &str, method: &str, body: Option<&str>, public_key: &st
|
|||
process::exit(1);
|
||||
}
|
||||
|
||||
String::from_utf8_lossy(&output.stdout).to_string()
|
||||
let result = String::from_utf8_lossy(&output.stdout).to_string();
|
||||
|
||||
// Check for timestamp authentication errors
|
||||
if result.contains("timestamp") && (result.contains("401") || result.contains("expired") || result.contains("invalid")) {
|
||||
eprintln!("{}Error: Request timestamp expired (must be within 5 minutes of server time){}", RED, RESET);
|
||||
eprintln!("{}Your computer's clock may have drifted.{}", YELLOW, RESET);
|
||||
eprintln!("Check your system time and sync with NTP if needed:");
|
||||
eprintln!(" Linux: sudo ntpdate -s time.nist.gov");
|
||||
eprintln!(" macOS: sudo sntp -sS time.apple.com");
|
||||
eprintln!(" Windows: w32tm /resync");
|
||||
process::exit(1);
|
||||
}
|
||||
|
||||
result
|
||||
}
|
||||
|
||||
fn cmd_execute(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue