File tree Expand file tree Collapse file tree 2 files changed +37
-3
lines changed
generator/common/src/main/kotlin/me/kcra/takenaka/generator/common/provider Expand file tree Collapse file tree 2 files changed +37
-3
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ * This file is part of takenaka, licensed under the Apache License, Version 2.0 (the "License").
3+ *
4+ * Copyright (c) 2023-2024 Matous Kucera
5+ *
6+ * You may not use this file except in compliance with the License.
7+ * You may obtain a copy of the License at
8+ *
9+ * http://www.apache.org/licenses/LICENSE-2.0
10+ *
11+ * Unless required by applicable law or agreed to in writing, software
12+ * distributed under the License is distributed on an "AS IS" BASIS,
13+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+ * See the License for the specific language governing permissions and
15+ * limitations under the License.
16+ */
17+
18+ package me.kcra.takenaka.generator.common.provider
19+
20+ /* *
21+ * A generic resolve-time exception wrapper.
22+ *
23+ * @author Matouš Kučera
24+ */
25+ open class ResolveException : RuntimeException {
26+ constructor (message: String , cause: Throwable ) : super (message, cause)
27+ constructor (message: String ) : super (message)
28+ }
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ import me.kcra.takenaka.core.versionManifest
3232import me.kcra.takenaka.core.versionManifestOf
3333import me.kcra.takenaka.generator.common.provider.MappingProvider
3434import io.github.oshai.kotlinlogging.KotlinLogging
35+ import me.kcra.takenaka.generator.common.provider.ResolveException
3536import net.fabricmc.mappingio.format.Tiny2Reader
3637import net.fabricmc.mappingio.format.Tiny2Writer
3738import net.fabricmc.mappingio.tree.MemoryMappingTree
@@ -144,12 +145,17 @@ class ResolvingMappingProvider @Deprecated(
144145 }
145146 }
146147
147- val tree = buildMappingTree {
148- contributor(contributors)
148+ val treeResult = runCatching {
149+ buildMappingTree {
150+ contributor(contributors)
149151
150- interceptors + = mappingConfig.interceptors
152+ interceptors + = mappingConfig.interceptors
153+ }
151154 }
152155
156+ val tree = treeResult.getOrElse { exc ->
157+ throw ResolveException (" Failed to create mapping tree for version ${workspace.version} " , exc)
158+ }
153159 if (analyzer != null ) {
154160 val time = measureTimeMillis { analyzer.accept(tree) }
155161 logger.info { " analyzed ${workspace.version.id} mappings in ${time} ms" }
You can’t perform that action at this time.
0 commit comments