From 97b05e78c5faba66559d09e3ce27ee4223d5006c Mon Sep 17 00:00:00 2001 From: AkiraFukushima Date: Thu, 27 Jun 2019 21:58:43 +0900 Subject: [PATCH] refs #921 Show error message when failed to start streamings --- .../locales/de/translation.missing.json | 3 ++- src/config/locales/en/translation.json | 1 + .../locales/fr/translation.missing.json | 3 ++- .../locales/it/translation.missing.json | 3 ++- src/config/locales/ja/translation.json | 1 + .../locales/ko/translation.missing.json | 3 ++- .../locales/pl/translation.missing.json | 3 ++- src/errors/streamingError.js | 6 +++++ src/main/index.ts | 6 +++-- src/renderer/components/GlobalHeader.vue | 27 +++++++++++++------ src/renderer/store/GlobalHeader.ts | 13 +++++---- 11 files changed, 47 insertions(+), 22 deletions(-) create mode 100644 src/errors/streamingError.js diff --git a/src/config/locales/de/translation.missing.json b/src/config/locales/de/translation.missing.json index 82e968f8..0d110df2 100644 --- a/src/config/locales/de/translation.missing.json +++ b/src/config/locales/de/translation.missing.json @@ -51,6 +51,7 @@ }, "message": { "follow_request_accept_error": "Failed to accept the request", - "follow_reuqest_reject_error": "failed to reject the request" + "follow_reuqest_reject_error": "failed to reject the request", + "start_all_streamings_error": "Failed to start streaming of {{domain}}" } } diff --git a/src/config/locales/en/translation.json b/src/config/locales/en/translation.json index cca48e04..f465d7fc 100644 --- a/src/config/locales/en/translation.json +++ b/src/config/locales/en/translation.json @@ -348,6 +348,7 @@ "follow_request_accept_error": "Failed to accept the request", "follow_reuqest_reject_error": "failed to reject the request", "start_streaming_error": "Failed to start streaming", + "start_all_streamings_error": "Failed to start streaming of {{domain}}", "attach_error": "Could not attach the file", "authorize_duplicate_error": "Can not login the same account of the same domain", "authorize_error": "Failed to authorize", diff --git a/src/config/locales/fr/translation.missing.json b/src/config/locales/fr/translation.missing.json index a0978700..bbce8059 100644 --- a/src/config/locales/fr/translation.missing.json +++ b/src/config/locales/fr/translation.missing.json @@ -17,6 +17,7 @@ }, "message": { "follow_request_accept_error": "Failed to accept the request", - "follow_reuqest_reject_error": "failed to reject the request" + "follow_reuqest_reject_error": "failed to reject the request", + "start_all_streamings_error": "Failed to start streaming of {{domain}}" } } diff --git a/src/config/locales/it/translation.missing.json b/src/config/locales/it/translation.missing.json index a0978700..bbce8059 100644 --- a/src/config/locales/it/translation.missing.json +++ b/src/config/locales/it/translation.missing.json @@ -17,6 +17,7 @@ }, "message": { "follow_request_accept_error": "Failed to accept the request", - "follow_reuqest_reject_error": "failed to reject the request" + "follow_reuqest_reject_error": "failed to reject the request", + "start_all_streamings_error": "Failed to start streaming of {{domain}}" } } diff --git a/src/config/locales/ja/translation.json b/src/config/locales/ja/translation.json index 5a70402c..6a9cc6a8 100644 --- a/src/config/locales/ja/translation.json +++ b/src/config/locales/ja/translation.json @@ -339,6 +339,7 @@ "follow_request_accept_error": "フォローリクエストの承認に失敗しました", "follow_reuqest_reject_error": "フォローリクエストの却下に失敗しました", "start_streaming_error": "ストリーミングを開始できませんでした", + "start_all_streamings_error": "{{domain}}のストリーミングを開始できませんでした", "attach_error": "ファイルを添付できませんでした", "authorize_duplicate_error": "同一ドメイン同一アカウントではログインできません", "authorize_error": "認証に失敗しました", diff --git a/src/config/locales/ko/translation.missing.json b/src/config/locales/ko/translation.missing.json index ea1833c5..53a849bf 100644 --- a/src/config/locales/ko/translation.missing.json +++ b/src/config/locales/ko/translation.missing.json @@ -26,6 +26,7 @@ }, "message": { "follow_request_accept_error": "Failed to accept the request", - "follow_reuqest_reject_error": "failed to reject the request" + "follow_reuqest_reject_error": "failed to reject the request", + "start_all_streamings_error": "Failed to start streaming of {{domain}}" } } diff --git a/src/config/locales/pl/translation.missing.json b/src/config/locales/pl/translation.missing.json index 82e968f8..0d110df2 100644 --- a/src/config/locales/pl/translation.missing.json +++ b/src/config/locales/pl/translation.missing.json @@ -51,6 +51,7 @@ }, "message": { "follow_request_accept_error": "Failed to accept the request", - "follow_reuqest_reject_error": "failed to reject the request" + "follow_reuqest_reject_error": "failed to reject the request", + "start_all_streamings_error": "Failed to start streaming of {{domain}}" } } diff --git a/src/errors/streamingError.js b/src/errors/streamingError.js new file mode 100644 index 00000000..6db498ec --- /dev/null +++ b/src/errors/streamingError.js @@ -0,0 +1,6 @@ +export class StreamingError extends Error { + constructor(message, domain) { + super(message) + this.domain = domain + } +} diff --git a/src/main/index.ts b/src/main/index.ts index 7e79678a..2ba41eb5 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -35,6 +35,7 @@ import { LocalAccount } from '~/src/types/localAccount' import { LocalTag } from '~/src/types/localTag' import { UnreadNotification as UnreadNotificationConfig } from '~/src/types/unreadNotification' import { AccountNotification } from '~/src/types/accountNotification' +import { StreamingError } from '~/src/errors/streamingError' /** * Context menu @@ -475,9 +476,10 @@ ipcMain.on('start-all-user-streamings', (event: Event, accounts: Array { + .catch((err: Error) => { log.error(err) - event.sender.send('error-start-all-user-streamings', err) + const streamingError = new StreamingError(err.message, account.domain) + event.sender.send('error-start-all-user-streamings', streamingError) }) }) }) diff --git a/src/renderer/components/GlobalHeader.vue b/src/renderer/components/GlobalHeader.vue index 82212892..534d4da0 100644 --- a/src/renderer/components/GlobalHeader.vue +++ b/src/renderer/components/GlobalHeader.vue @@ -31,6 +31,7 @@