SpotifyException.fromException constructor
SpotifyException.fromException()
Factory translating any generic Exception or PlatformException into a specific SpotifyException subclass.
Implementation
factory SpotifyException.fromException(Exception e) {
if (e is SpotifyException) {
return e;
}
if (e is MissingPluginException) {
return SpotifyUnimplementedException(
e.message ?? 'Method not implemented on this platform',
cause: e,
);
}
if (e is PlatformException) {
return SpotifyException.fromPlatformException(e);
}
return SpotifyGeneralException(
e.toString(),
cause: e,
);
}