@@ -68,13 +68,24 @@ class Twitter {
6868
6969 // エラー処理
7070 if ( response . type === 'error' ) {
71- if ( typeof response . data . detail === 'string' &&
72- response . data . detail . startsWith ( 'Failed to get user information' ) ) {
73- Message . error ( 'Twitter アカウント情報の取得に失敗しました。有効な Cookie を入力してください。' ) ;
74- return false ;
71+ switch ( response . data . detail ) {
72+ case 'No valid cookies found in the provided cookies.txt' : {
73+ Message . error ( 'Cookie データのフォーマットが不正です。Netscape 形式の Cookie データを入力してください。' ) ;
74+ break ;
75+ }
76+ case 'Failed to get user information' : {
77+ Message . error ( 'Twitter アカウント情報の取得に失敗しました。' ) ;
78+ break ;
79+ }
80+ case 'Chrome or Brave is not installed on this machine.' : {
81+ Message . error ( 'ヘッドレスブラウザの起動に必要な Chrome または Brave が KonomiTV サーバーにインストールされていません。' ) ;
82+ break ;
83+ }
84+ default : {
85+ APIClient . showGenericError ( response , 'Twitter アカウントとの連携に失敗しました。再度お試しください。' ) ;
86+ break ;
87+ }
7588 }
76- // 上記以外のエラー
77- APIClient . showGenericError ( response , 'Twitter アカウントとの連携に失敗しました。' ) ;
7889 return false ;
7990 }
8091
@@ -194,11 +205,7 @@ class Twitter {
194205
195206 // エラー処理
196207 if ( response . type === 'error' ) {
197- switch ( response . data . detail ) {
198- default :
199- APIClient . showGenericError ( response , 'ツイートをリツイートできませんでした。' ) ;
200- break ;
201- }
208+ APIClient . showGenericError ( response , 'ツイートをリツイートできませんでした。' ) ;
202209 return null ;
203210 }
204211
@@ -226,11 +233,7 @@ class Twitter {
226233
227234 // エラー処理
228235 if ( response . type === 'error' ) {
229- switch ( response . data . detail ) {
230- default :
231- APIClient . showGenericError ( response , 'リツイートを取り消せませんでした。' ) ;
232- break ;
233- }
236+ APIClient . showGenericError ( response , 'リツイートを取り消せませんでした。' ) ;
234237 return null ;
235238 }
236239
@@ -258,11 +261,7 @@ class Twitter {
258261
259262 // エラー処理
260263 if ( response . type === 'error' ) {
261- switch ( response . data . detail ) {
262- default :
263- APIClient . showGenericError ( response , 'ツイートをいいねできませんでした。' ) ;
264- break ;
265- }
264+ APIClient . showGenericError ( response , 'ツイートをいいねできませんでした。' ) ;
266265 return null ;
267266 }
268267
@@ -290,11 +289,7 @@ class Twitter {
290289
291290 // エラー処理
292291 if ( response . type === 'error' ) {
293- switch ( response . data . detail ) {
294- default :
295- APIClient . showGenericError ( response , 'いいねを取り消せませんでした。' ) ;
296- break ;
297- }
292+ APIClient . showGenericError ( response , 'いいねを取り消せませんでした。' ) ;
298293 return null ;
299294 }
300295
@@ -324,11 +319,7 @@ class Twitter {
324319
325320 // エラー処理
326321 if ( response . type === 'error' ) {
327- switch ( response . data . detail ) {
328- default :
329- APIClient . showGenericError ( response , 'ホームタイムラインを取得できませんでした。' ) ;
330- break ;
331- }
322+ APIClient . showGenericError ( response , 'ホームタイムラインを取得できませんでした。' ) ;
332323 return null ;
333324 }
334325
@@ -359,11 +350,7 @@ class Twitter {
359350
360351 // エラー処理
361352 if ( response . type === 'error' ) {
362- switch ( response . data . detail ) {
363- default :
364- APIClient . showGenericError ( response , 'ツイートの検索に失敗しました。' ) ;
365- break ;
366- }
353+ APIClient . showGenericError ( response , 'ツイートの検索に失敗しました。' ) ;
367354 return null ;
368355 }
369356
0 commit comments