writeStoreErrorBusyAs is writeStoreErrorR for the paths where the default busy wording would be untrue: a step that runs AFTER the main write committed (credentials changed, then the session refresh was busy) cannot say "nothing was saved". busyMessage replaces the wording; the status, code and Retr
(w http.ResponseWriter, r *http.Request, err error, status int, code, message, busyMessage string)
| 3227 | // say "nothing was saved". busyMessage replaces the wording; the status, code |
| 3228 | // and Retry-After are unchanged. |
| 3229 | func writeStoreErrorBusyAs(w http.ResponseWriter, r *http.Request, err error, status int, code, message, busyMessage string) { |
| 3230 | if errors.Is(r.Context().Err(), context.Canceled) { |
| 3231 | // The client is gone, so the body is moot, but the status is still |
| 3232 | // recorded by logs and middleware: a header-only 503, never an |
| 3233 | // implicit 200 (a store call that failed is not a success). |
| 3234 | slog.Debug("request cancelled; store call abandoned", "error", err, "code", code) |
| 3235 | w.WriteHeader(http.StatusServiceUnavailable) |
| 3236 | return |
| 3237 | } |
| 3238 | if store.IsDBRetryable(err) { |
| 3239 | slog.Warn("database busy", "error", err, "code", code, "method", r.Method) |
| 3240 | if busyMessage != "" { |
| 3241 | writeBusyMessage(w, busyMessage) |
| 3242 | return |
| 3243 | } |
| 3244 | writeBusy(w, err, isWriteMethod(r.Method)) |
| 3245 | return |
| 3246 | } |
| 3247 | slog.Error(message, "error", err, "code", code) |
| 3248 | writeError(w, status, code, message) |
| 3249 | } |
| 3250 | |
| 3251 | // importPartiallyRemappedCode is the 500 code of a bundle import whose |
| 3252 | // attachment-reference remap stopped between chunks (TASK-4278). The workspace |