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
12
un.groovy
12
un.groovy
|
|
@ -168,6 +168,18 @@ def apiRequest(endpoint, method, data, publicKey, secretKey) {
|
|||
System.exit(1)
|
||||
}
|
||||
|
||||
// Check for timestamp authentication errors
|
||||
if (output.toLowerCase().contains('timestamp') &&
|
||||
(output.contains('401') || output.toLowerCase().contains('expired') || output.toLowerCase().contains('invalid'))) {
|
||||
System.err.println("${RED}Error: Request timestamp expired (must be within 5 minutes of server time)${RESET}")
|
||||
System.err.println("${YELLOW}Your computer's clock may have drifted.${RESET}")
|
||||
System.err.println("Check your system time and sync with NTP if needed:")
|
||||
System.err.println(" Linux: sudo ntpdate -s time.nist.gov")
|
||||
System.err.println(" macOS: sudo sntp -sS time.apple.com")
|
||||
System.err.println(" Windows: w32tm /resync")
|
||||
System.exit(1)
|
||||
}
|
||||
|
||||
return output
|
||||
} finally {
|
||||
tempFile.delete()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue