mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: display trial errors in the dashboard (#13601)
* fix: display trial errors in the dashboard The error was essentially being ignored before! * Remove day mention in product of trial * fmt
This commit is contained in:
@@ -39,6 +39,22 @@ func New(db database.Store, url string, keys map[string]ed25519.PublicKey) func(
|
||||
return xerrors.Errorf("perform license request: %w", err)
|
||||
}
|
||||
defer res.Body.Close()
|
||||
if res.StatusCode > 300 {
|
||||
body, err := io.ReadAll(res.Body)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("read license response: %w", err)
|
||||
}
|
||||
// This is the format of the error response from
|
||||
// the license server.
|
||||
var msg struct {
|
||||
Error string `json:"error"`
|
||||
}
|
||||
err = json.Unmarshal(body, &msg)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("unmarshal error: %w", err)
|
||||
}
|
||||
return xerrors.New(msg.Error)
|
||||
}
|
||||
raw, err := io.ReadAll(res.Body)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("read license: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user