Add clock drift error messages to remaining 18 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.cs, Un.java, un.clj, un.cob, un.erl, un.ex, un.f90, un.forth, un.fs, un.hs, un.lisp, un.m, un.ml, un.pro, un.r, un.raku, un.scm, un.zig All 42 implementations now have clock drift detection.
This commit is contained in:
parent
bc0da08a08
commit
a5a4f23594
18 changed files with 455 additions and 42 deletions
22
un.fs
22
un.fs
|
|
@ -279,6 +279,17 @@ let apiRequest (endpoint: string) (method: string) (data: (string * obj) list op
|
|||
reader.ReadToEnd()
|
||||
else
|
||||
ex.Message
|
||||
|
||||
// Check for clock drift error
|
||||
if errorMsg.Contains("timestamp") && (errorMsg.Contains("401") || errorMsg.Contains("expired") || errorMsg.Contains("invalid")) then
|
||||
eprintfn "%sError: Request timestamp expired (must be within 5 minutes of server time)%s" red reset
|
||||
eprintfn "%sYour computer's clock may have drifted.%s" yellow reset
|
||||
eprintfn "Check your system time and sync with NTP if needed:"
|
||||
eprintfn " Linux: sudo ntpdate -s time.nist.gov"
|
||||
eprintfn " macOS: sudo sntp -sS time.apple.com"
|
||||
eprintfn " Windows: w32tm /resync%s" reset
|
||||
exit 1
|
||||
|
||||
failwithf "HTTP error - %s" errorMsg
|
||||
|
||||
let cmdExecute (args: Args) =
|
||||
|
|
@ -432,6 +443,17 @@ let cmdKey (args: Args) =
|
|||
with _ -> body
|
||||
else
|
||||
ex.Message
|
||||
|
||||
// Check for clock drift error
|
||||
if errorMsg.Contains("timestamp") && (errorMsg.Contains("401") || errorMsg.Contains("expired") || errorMsg.Contains("invalid")) then
|
||||
eprintfn "%sError: Request timestamp expired (must be within 5 minutes of server time)%s" red reset
|
||||
eprintfn "%sYour computer's clock may have drifted.%s" yellow reset
|
||||
eprintfn "Check your system time and sync with NTP if needed:"
|
||||
eprintfn " Linux: sudo ntpdate -s time.nist.gov"
|
||||
eprintfn " macOS: sudo sntp -sS time.apple.com"
|
||||
eprintfn " Windows: w32tm /resync%s" reset
|
||||
exit 1
|
||||
|
||||
printfn "Reason: %s" errorMsg
|
||||
exit 1
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue