File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,9 @@ let package = Package(
24
24
dependencies: [
25
25
. product( name: " SwiftSyntaxMacros " , package : " swift-syntax " ) ,
26
26
. product( name: " SwiftCompilerPlugin " , package : " swift-syntax " )
27
+ ] ,
28
+ swiftSettings: [
29
+ . define( " DEBUG " , . when( configuration: . debug) )
27
30
]
28
31
) ,
29
32
// Targets are the basic building blocks of a package, defining a module or a test suite.
Original file line number Diff line number Diff line change @@ -22,7 +22,9 @@ public extension LoggableError {
22
22
}
23
23
24
24
public enum Error {
25
-
25
+ static var hash : String = " *hashed* "
26
+ static var hashObject = Hash ( )
27
+ struct Hash { }
26
28
}
27
29
28
30
extension Error {
@@ -38,7 +40,11 @@ extension Error.JSON {
38
40
public var debugDescription : String {
39
41
switch self {
40
42
case . invalidCallingFromJS( let string) :
43
+ #if DEBUG
41
44
" JS called with invalid parameters: \( string) "
45
+ #else
46
+ " JS called with invalid parameters: \( Error . hash) "
47
+ #endif
42
48
case . underlyingJSONSerialization( let error) :
43
49
" Error from JSONSerialization: \( error) "
44
50
}
@@ -56,11 +62,19 @@ extension Error.JSON {
56
62
public var debugDescription : String {
57
63
switch self {
58
64
case . failedToEncode( let object) :
65
+ #if DEBUG
59
66
" Failed to encode JSON data into UTF-8 text: \( object) "
67
+ #else
68
+ " Failed to encode JSON data into UTF-8 text: \( Error . hashObject) "
69
+ #endif
60
70
case . underlyingJSONEncoding( let error) :
61
71
" Error from JSONEncoder: \( error) "
62
72
case . invalidJSONObject( let object) :
73
+ #if DEBUG
63
74
" Object is not a valid JSON object: \( object) "
75
+ #else
76
+ " Object is not a valid JSON object: \( Error . hashObject) "
77
+ #endif
64
78
}
65
79
}
66
80
You can’t perform that action at this time.
0 commit comments