Sponsor: improve expire message (#26284)
This commit is contained in:
parent
af9927d421
commit
916de19f4f
2 changed files with 9 additions and 2 deletions
|
|
@ -71,6 +71,8 @@ test.describe("sponsor token", () => {
|
|||
await textarea.fill(EXPIRED_TOKEN);
|
||||
// Try to save to trigger validation
|
||||
await modal.getByRole("button", { name: "Save" }).click();
|
||||
await expect(modal).toContainText("token is expired");
|
||||
await expect(modal).toContainText(
|
||||
"token is expired - get a fresh one from https://sponsor.evcc.io"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package sponsor
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
|
|
@ -75,7 +76,11 @@ func ConfigureSponsorship(token string) error {
|
|||
Subject = unavailable
|
||||
err = nil
|
||||
} else {
|
||||
err = fmt.Errorf("sponsortoken: %w", err)
|
||||
if strings.Contains(err.Error(), "token is expired") {
|
||||
err = fmt.Errorf("%w - get a fresh one from https://sponsor.evcc.io", err)
|
||||
} else {
|
||||
err = fmt.Errorf("sponsortoken: %w", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue