-
-
Notifications
You must be signed in to change notification settings - Fork 687
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: cleanup track loading * fix: kdoc
- Loading branch information
Showing
4 changed files
with
89 additions
and
142 deletions.
There are no files selected for viewing
95 changes: 0 additions & 95 deletions
95
LavalinkServer/src/main/java/lavalink/server/player/AudioLoader.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
LavalinkServer/src/main/java/lavalink/server/util/loading.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package lavalink.server.util | ||
|
||
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager | ||
import com.sedmelluq.discord.lavaplayer.tools.ExceptionTools | ||
import com.sedmelluq.discord.lavaplayer.tools.FriendlyException | ||
import com.sedmelluq.discord.lavaplayer.track.AudioItem | ||
|
||
/** | ||
* Loads an audio item from the specified [identifier]. | ||
* | ||
* This method wraps any exceptions thrown by the [AudioPlayerManager.loadItem] method in a [FriendlyException]. | ||
* This is meant to maintain the behavior from callback-style item loading. | ||
*/ | ||
fun loadAudioItem(manager: AudioPlayerManager, identifier: String): AudioItem? = try { | ||
manager.loadItemSync(identifier) | ||
} catch (ex: Throwable) { | ||
// re-throw any errors that are not exceptions | ||
ExceptionTools.rethrowErrors(ex) | ||
|
||
throw FriendlyException( | ||
"Something went wrong while looking up the track.", | ||
FriendlyException.Severity.FAULT, | ||
ex | ||
) | ||
} |