aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2021-05-09 06:31:46 +0000
committerGitHub <noreply@github.com>2021-05-09 06:31:46 +0000
commit03bf63a1fa872c17cca99ff60967c05c1bca9a7e (patch)
tree7d96d22a4df21179080c190276c8759afc583bf1 /src
parent479efbdb4116a13d27f0ac7e8abb3ef86bdd6273 (diff)
parentca3f03ea5ed46d4a6c4815bedd2469a69f3b1183 (diff)
Merge pull request #1146 from ueokande/improve-error-message
Improve an error message on invalid settings
Diffstat (limited to 'src')
-rw-r--r--src/background/presenters/Notifier.ts10
-rw-r--r--src/background/usecases/SettingUseCase.ts2
2 files changed, 7 insertions, 5 deletions
diff --git a/src/background/presenters/Notifier.ts b/src/background/presenters/Notifier.ts
index 957572d..d828b2e 100644
--- a/src/background/presenters/Notifier.ts
+++ b/src/background/presenters/Notifier.ts
@@ -4,7 +4,7 @@ const NOTIFICATION_ID_INVALID_SETTINGS = "vimvixen-update-invalid-settings";
export default interface Notifier {
notifyUpdated(version: string, onclick: () => void): Promise<void>;
- notifyInvalidSettings(onclick: () => void): Promise<void>;
+ notifyInvalidSettings(error: Error, onclick: () => void): Promise<void>;
}
export class NotifierImpl implements NotifierImpl {
@@ -29,11 +29,13 @@ export class NotifierImpl implements NotifierImpl {
});
}
- async notifyInvalidSettings(onclick: () => void): Promise<void> {
+ async notifyInvalidSettings(
+ error: Error,
+ onclick: () => void
+ ): Promise<void> {
const title = `Loading settings failed`;
// eslint-disable-next-line max-len
- const message =
- "The default settings are used due to the last saved settings is invalid. Check your current settings from the add-on preference";
+ const message = `The default settings are used due to the last saved settings is invalid. Check your current settings from the add-on preference: ${error.message}`;
const listener = (id: string) => {
if (id !== NOTIFICATION_ID_INVALID_SETTINGS) {
diff --git a/src/background/usecases/SettingUseCase.ts b/src/background/usecases/SettingUseCase.ts
index 34c1f3a..07f0d7c 100644
--- a/src/background/usecases/SettingUseCase.ts
+++ b/src/background/usecases/SettingUseCase.ts
@@ -54,7 +54,7 @@ export default class SettingUseCase {
private showUnableToLoad(e: Error) {
console.error("unable to load settings", e);
- this.notifier.notifyInvalidSettings(() => {
+ this.notifier.notifyInvalidSettings(e, () => {
browser.runtime.openOptionsPage();
});
}