File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,7 +25,9 @@ const getHandler = (name: string, neteaseApi: (params: any) => any) => {
2525 if ( [ 400 , 301 ] . includes ( error . status ) ) {
2626 return reply . status ( error . status ) . send ( error . body ) ;
2727 }
28- return reply . status ( 500 ) ;
28+ return reply
29+ . status ( 500 )
30+ . send ( error . body || { error : error . message || "Internal Server Error" } ) ;
2931 }
3032 } ;
3133} ;
Original file line number Diff line number Diff line change @@ -217,12 +217,9 @@ class Player {
217217 if ( seek && seek > 0 ) {
218218 audioManager . seek ( seek / 1000 ) ;
219219 }
220- } catch ( e ) {
221- console . error ( "Player create failed" , e ) ;
222- // 触发错误处理
223- const errCode = audioManager . getErrorCode ( ) ;
224- await this . handlePlaybackError ( errCode || undefined ) ;
225- throw e ;
220+ } catch ( err ) {
221+ console . error ( "❌ 播放器初始化失败:" , err ) ;
222+ throw err ;
226223 }
227224 // 获取歌词数据
228225 lyricManager . handleLyric ( id , path ) ;
@@ -317,6 +314,22 @@ class Player {
317314 this . retryInfo = { songId : Number ( currentSongId || 0 ) , count : 0 } ;
318315 }
319316 this . retryInfo . count += 1 ;
317+ // 如果错误码未定义或为 0,且重试次数过多,直接跳过避免无限重试
318+ if ( ( errCode === undefined || errCode === 0 ) && this . retryInfo . count > 2 ) {
319+ console . warn ( "⚠️ 未知错误且重试次数过多,跳过重试:" , {
320+ count : this . retryInfo . count ,
321+ errCode,
322+ } ) ;
323+ this . retryInfo . count = 0 ;
324+ if ( dataStore . playList . length > 1 ) {
325+ window . $message . error ( "播放失败,已跳至下一首" ) ;
326+ await this . nextOrPrev ( "next" ) ;
327+ } else {
328+ window . $message . error ( "当前列表暂无可播放歌曲" ) ;
329+ this . cleanPlayList ( ) ;
330+ }
331+ return ;
332+ }
320333 // 1:用户中止了加载,不进行重试
321334 if ( errCode === 1 ) {
322335 console . log ( "⏸️ 用户中止播放,不进行重试" ) ;
You can’t perform that action at this time.
0 commit comments