Skip to content

Commit 291551b

Browse files
Net 687 : fix license validation failure log (#2675)
* On license validation fail, parse and store the message of the response * Return cached response body when necessary * Have license validation return proper val,err * Improve logs readability on lic val error
1 parent 82bbf92 commit 291551b

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

pro/license.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -237,13 +237,10 @@ func validateLicenseKey(encryptedData []byte, publicKey *[32]byte) ([]byte, erro
237237
// at this point the backend returned some undesired state
238238

239239
// inform failure via logs
240-
err = fmt.Errorf("could not validate license with validation backend, got status code %d", validateResponse.StatusCode)
240+
body, _ := io.ReadAll(validateResponse.Body)
241+
err = fmt.Errorf("could not validate license with validation backend (status={%d}, body={%s})",
242+
validateResponse.StatusCode, string(body))
241243
slog.Warn(err.Error())
242-
body, err := io.ReadAll(validateResponse.Body)
243-
if err != nil {
244-
slog.Warn(err.Error())
245-
}
246-
slog.Warn("license-validation backend response: %s", string(body))
247244

248245
// try to use cache if we had a temporary error
249246
if code == http.StatusServiceUnavailable || code == http.StatusGatewayTimeout {

0 commit comments

Comments
 (0)