Skip to content

Commit 6636347

Browse files
authored
chore: Use launch over async to prevent error suppression
1 parent 6240025 commit 6636347

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

interfaces/src/main/kotlin/com/noxcrew/interfaces/view/AbstractInterfaceView.kt

+5-10
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import com.noxcrew.interfaces.utilities.CollapsablePaneMap
1717
import com.noxcrew.interfaces.utilities.InterfacesCoroutineDetails
1818
import com.noxcrew.interfaces.utilities.forEachInGrid
1919
import kotlinx.coroutines.Job
20-
import kotlinx.coroutines.async
2120
import kotlinx.coroutines.launch
2221
import kotlinx.coroutines.sync.Mutex
2322
import kotlinx.coroutines.withTimeout
@@ -257,7 +256,7 @@ public abstract class AbstractInterfaceView<I : InterfacesInventory, T : Interfa
257256

258257
// Start the job if it's not running currently!
259258
if (transformingJob == null || transformingJob?.isCompleted == true) {
260-
transformingJob = SCOPE.async(
259+
transformingJob = SCOPE.launch(
261260
InterfacesCoroutineDetails(player.uniqueId, "running and applying a transform")
262261
) {
263262
// Go through all pending transforms one at a time until
@@ -267,15 +266,11 @@ public abstract class AbstractInterfaceView<I : InterfacesInventory, T : Interfa
267266
// Removes the first pending transform
268267
val transform = pendingTransforms.remove()
269268

270-
try {
271-
// Don't run transforms for an offline player!
272-
if (!Bukkit.isStopping() && player.isOnline) {
273-
withTimeout(6.seconds) {
274-
runTransformAndApplyToPanes(transform)
275-
}
269+
// Don't run transforms for an offline player!
270+
if (!Bukkit.isStopping() && player.isOnline) {
271+
withTimeout(6.seconds) {
272+
runTransformAndApplyToPanes(transform)
276273
}
277-
} catch (exception: Exception) {
278-
logger.error("Failed to run and apply transform: $transform", exception)
279274
}
280275
}
281276

0 commit comments

Comments
 (0)