Skip to content

Commit

Permalink
More detailed error for parsing the eapk
Browse files Browse the repository at this point in the history
  • Loading branch information
brahmkshatriya committed Oct 17, 2024
1 parent 652f5f8 commit 5fc8c44
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,17 @@ class ExtensionLoader(
val musicExtensions = extensionListFlow.value.orEmpty()
list?.forEach { extension ->
extension.get<TrackerClientsProvider, Unit>(throwableFlow) {
inject(requiredTrackerClients, trackerExtensions) {
inject(extension.name, requiredTrackerClients, trackerExtensions) {
setTrackerExtensions(it)
}
}
extension.get<LyricsClientsProvider, Unit>(throwableFlow) {
inject(requiredLyricsClients, lyricsExtensions) {
inject(extension.name, requiredLyricsClients, lyricsExtensions) {
setLyricsExtensions(it)
}
}
extension.get<MusicClientsProvider, Unit>(throwableFlow) {
inject(requiredMusicClients, musicExtensions) {
inject(extension.name, requiredMusicClients, musicExtensions) {
setMusicExtensions(it)
}
}
Expand All @@ -147,6 +147,7 @@ class ExtensionLoader(
}

private fun <T, R : Extension<*>> T.inject(
name: String,
required: List<String>,
extensions: List<R>,
set: T.(List<R>) -> Unit
Expand All @@ -155,7 +156,7 @@ class ExtensionLoader(
else {
val filtered = extensions.filter { it.metadata.id in required }
if (filtered.size == required.size) set(filtered)
else throw RequiredExtensionsException(required)
else throw RequiredExtensionsException(name, required)
}
}

Expand Down

0 comments on commit 5fc8c44

Please sign in to comment.