11import { useState , useEffect , useRef } from "react" ;
22import { invoke } from "@tauri-apps/api/core" ;
33import { listen } from "@tauri-apps/api/event" ;
4+ import { message } from "@tauri-apps/plugin-dialog" ;
45import { use_lib , use_settings } from "@/ctx" ;
56import type { SpPlaylist , SpTrack } from "@/components/spotify/discover" ;
67import type { YtPlaylistResult , YtTrack } from "@/components/youtube/discover" ;
@@ -194,8 +195,9 @@ export function StepMigrate({ on_next }: Props) {
194195 } ) ;
195196 set_sp_pls ( pls ) ;
196197 set_sp_checked ( new Set ( pls . map ( ( p ) => p . id ) ) ) ;
197- } catch {
198+ } catch ( e ) {
198199 set_sp_pls ( [ ] ) ;
200+ message ( `Failed to load playlists:\n${ e } ` , { title : "Spotify Error" , kind : "error" } ) ;
199201 } finally {
200202 set_sp_pls_loading ( false ) ;
201203 }
@@ -216,7 +218,10 @@ export function StepMigrate({ on_next }: Props) {
216218 let token : string ;
217219 try {
218220 token = await sp_token ( ) ;
219- } catch { return ; }
221+ } catch ( e ) {
222+ message ( `Failed to get Spotify token:\n${ e } ` , { title : "Spotify Error" , kind : "error" } ) ;
223+ return ;
224+ }
220225
221226 const items : {
222227 name : string ;
@@ -230,7 +235,10 @@ export function StepMigrate({ on_next }: Props) {
230235 accessToken : token ,
231236 } ) ;
232237 items . push ( { name : "Liked Songs" , kind : "liked" , tracks } ) ;
233- } catch ( e ) { console . error ( "sp_liked_tracks:" , e ) ; }
238+ } catch ( e ) {
239+ console . error ( "sp_liked_tracks:" , e ) ;
240+ message ( `Failed to load liked songs:\n${ e } ` , { title : "Spotify Error" , kind : "error" } ) ;
241+ }
234242 }
235243
236244 for ( const id of sp_checked ) {
@@ -242,7 +250,10 @@ export function StepMigrate({ on_next }: Props) {
242250 id,
243251 } ) ;
244252 items . push ( { name : pl . name , kind : "playlist" , tracks } ) ;
245- } catch ( e ) { console . error ( "sp_playlist_tracks:" , e ) ; }
253+ } catch ( e ) {
254+ console . error ( "sp_playlist_tracks:" , e ) ;
255+ message ( `Failed to load playlist "${ pl . name } ":\n${ e } ` , { title : "Spotify Error" , kind : "error" } ) ;
256+ }
246257 }
247258
248259 const total = items . reduce ( ( s , i ) => s + i . tracks . length , 0 ) ;
0 commit comments