1
+ @file:OptIn(ExperimentalSerializationApi ::class )
2
+
1
3
package com.tomwyr.common
2
4
5
+ import kotlinx.serialization.ExperimentalSerializationApi
6
+ import kotlinx.serialization.SerialName
3
7
import kotlinx.serialization.Serializable
8
+ import kotlinx.serialization.json.JsonClassDiscriminator
4
9
5
10
sealed class GodotKotlinTreeError : Exception () {
6
11
override fun getLocalizedMessage (): String = when (this ) {
@@ -11,6 +16,7 @@ sealed class GodotKotlinTreeError : Exception() {
11
16
class GeneratorError (val error : GodotNodeTreeError ) : GodotKotlinTreeError()
12
17
13
18
@Serializable
19
+ @JsonClassDiscriminator(" errorType" )
14
20
sealed class GodotNodeTreeError : Exception () {
15
21
override fun getLocalizedMessage (): String = when (this ) {
16
22
is InvalidGodotProject -> " Godot project could not be found at path `$projectPath `."
@@ -23,19 +29,25 @@ sealed class GodotNodeTreeError : Exception() {
23
29
}
24
30
25
31
@Serializable
32
+ @SerialName(" invalidGodotProject" )
26
33
class InvalidGodotProject (val projectPath : String ) : GodotNodeTreeError()
27
34
28
35
@Serializable
36
+ @SerialName(" scanningScenesFailed" )
29
37
class ScanningScenesFailed (val projectPath : String ) : GodotNodeTreeError()
30
38
31
39
@Serializable
40
+ @SerialName(" readingSceneFailed" )
32
41
class ReadingSceneFailed (val scenePath : String ) : GodotNodeTreeError()
33
42
34
43
@Serializable
44
+ @SerialName(" unexpectedNodeParameters" )
35
45
class UnexpectedNodeParameters (val nodeParams : NodeParams ) : GodotNodeTreeError()
36
46
37
47
@Serializable
48
+ @SerialName(" unexpectedSceneResource" )
38
49
class UnexpectedSceneResource (val instance : String ) : GodotNodeTreeError()
39
50
40
51
@Serializable
52
+ @SerialName(" parentNodeNotFound" )
41
53
class ParentNodeNotFound (val sceneName : String ) : GodotNodeTreeError()
0 commit comments