mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 16:05:18 +00:00

- Implemented ErrorBox for displaying error messages with retry functionality and log viewing. - Created NoDefaultMetadataPlugin to inform users about missing default metadata providers and provide navigation to manage them.
80 lines
2.9 KiB
Dart
80 lines
2.9 KiB
Dart
enum MetadataPluginErrorCode {
|
|
pluginApiVersionMismatch,
|
|
invalidPluginConfiguration,
|
|
failedToGetReleaseInfo,
|
|
noReleasesFound,
|
|
assetUrlNotFound,
|
|
pluginConfigJsonNotFound,
|
|
unsupportedPluginDownloadWebsite,
|
|
pluginDownloadFailed,
|
|
duplicatePlugin,
|
|
pluginByteCodeFileNotFound,
|
|
noDefaultPlugin,
|
|
}
|
|
|
|
class MetadataPluginException implements Exception {
|
|
final String message;
|
|
final MetadataPluginErrorCode errorCode;
|
|
|
|
MetadataPluginException._(this.message, {required this.errorCode});
|
|
MetadataPluginException.pluginApiVersionMismatch()
|
|
: this._(
|
|
'Plugin API version mismatch',
|
|
errorCode: MetadataPluginErrorCode.pluginApiVersionMismatch,
|
|
);
|
|
MetadataPluginException.invalidPluginConfiguration()
|
|
: this._(
|
|
'Invalid plugin configuration',
|
|
errorCode: MetadataPluginErrorCode.invalidPluginConfiguration,
|
|
);
|
|
MetadataPluginException.failedToGetRelease()
|
|
: this._(
|
|
'Failed to get release information',
|
|
errorCode: MetadataPluginErrorCode.failedToGetReleaseInfo,
|
|
);
|
|
MetadataPluginException.noReleasesFound()
|
|
: this._(
|
|
'No releases found for the plugin',
|
|
errorCode: MetadataPluginErrorCode.noReleasesFound,
|
|
);
|
|
|
|
MetadataPluginException.assetUrlNotFound()
|
|
: this._(
|
|
'No asset URL found for the plugin release',
|
|
errorCode: MetadataPluginErrorCode.assetUrlNotFound,
|
|
);
|
|
MetadataPluginException.pluginConfigJsonNotFound()
|
|
: this._(
|
|
'Plugin configuration JSON, plugin.json file not found',
|
|
errorCode: MetadataPluginErrorCode.pluginConfigJsonNotFound,
|
|
);
|
|
MetadataPluginException.unsupportedPluginDownloadWebsite()
|
|
: this._(
|
|
'Unsupported plugin download website. Please use GitHub or Codeberg.',
|
|
errorCode: MetadataPluginErrorCode.unsupportedPluginDownloadWebsite,
|
|
);
|
|
MetadataPluginException.pluginDownloadFailed()
|
|
: this._(
|
|
'Failed to download the plugin. Please check your internet connection or try again later.',
|
|
errorCode: MetadataPluginErrorCode.pluginDownloadFailed,
|
|
);
|
|
MetadataPluginException.duplicatePlugin()
|
|
: this._(
|
|
'Same plugin already exists with the same name and version.',
|
|
errorCode: MetadataPluginErrorCode.duplicatePlugin,
|
|
);
|
|
MetadataPluginException.pluginByteCodeFileNotFound()
|
|
: this._(
|
|
'Plugin byte code file, plugin.out not found. Please ensure the plugin is correctly packaged.',
|
|
errorCode: MetadataPluginErrorCode.pluginByteCodeFileNotFound,
|
|
);
|
|
MetadataPluginException.noDefaultPlugin()
|
|
: this._(
|
|
'No default metadata plugin is set. Please set a default plugin in the settings.',
|
|
errorCode: MetadataPluginErrorCode.noDefaultPlugin,
|
|
);
|
|
|
|
@override
|
|
String toString() => 'MetadataPluginException: $message';
|
|
}
|