Skip to main content

is_server_error

Function is_server_error 

Source
pub fn is_server_error(output: &str) -> bool
Expand description

What: Whether the output of a failed git-lfs push says the LFS server answered with a retryable server error, and says nothing that retrying cannot fix. Why: A positive match on the program’s own words (Server error: <url> for 500, Server error <url> from HTTP 5xx for the other retryable 5xx) keeps every unknown failure terminal. A line naming a refused credential, a missing object or a locked file anywhere in the output makes the whole failure terminal, because a retry would meet it again. The words are git-lfs’s English messages; a translated message is not retried, which fails toward the explanation.

In TS you’d write (pseudocode):

lines.some(isServerErrorLine) && !lines.some((line) => PERMANENT_MARKERS.some((marker) => line.includes(marker)))