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)
| 3134 | // say "nothing was saved". busyMessage replaces the wording; the status, code |
| 3135 | // and Retry-After are unchanged. |
| 3136 | func writeStoreErrorBusyAs(w http.ResponseWriter, r *http.Request, err error, status int, code, message, busyMessage string) { |
| 3137 | if errors.Is(r.Context().Err(), context.Canceled) { |
| 3138 | // The client is gone, so the body is moot, but the status is still |
| 3139 | // recorded by logs and middleware: a header-only 503, never an |
| 3140 | // implicit 200 (a store call that failed is not a success). |
| 3141 | slog.Debug("request cancelled; store call abandoned", "error", err, "code", code) |
| 3142 | w.WriteHeader(http.StatusServiceUnavailable) |
| 3143 | return |
| 3144 | } |
| 3145 | if store.IsDBRetryable(err) { |
| 3146 | slog.Warn("database busy", "error", err, "code", code, "method", r.Method) |
| 3147 | if busyMessage != "" { |
| 3148 | writeBusyMessage(w, busyMessage) |
| 3149 | return |
| 3150 | } |
| 3151 | writeBusy(w, err, isWriteMethod(r.Method)) |
| 3152 | return |
| 3153 | } |
| 3154 | slog.Error(message, "error", err, "code", code) |
| 3155 | writeError(w, status, code, message) |
| 3156 | } |
| 3157 | |
| 3158 | // importPartiallyRemappedCode is the 500 code of a bundle import whose |
| 3159 | // attachment-reference remap stopped between chunks (TASK-4278). The workspace |