@@ -56,85 +56,165 @@ extension Error: LocalizedError {
5656 public var errorDescription : String ? {
5757 switch self {
5858 case . invalidWindsAloftHeader, . invalidWindsAloftGroup, . invalidWindsAloftColumns:
59+ #if canImport(Darwin)
5960 return String (
6061 localized: " Couldn’t parse Winds Aloft product. " ,
6162 comment: " error description "
6263 )
64+ #else
65+ return " Couldn’t parse Winds Aloft product. "
66+ #endif
6367 default :
68+ #if canImport(Darwin)
6469 return String ( localized: " Couldn’t parse METAR or TAF. " , comment: " error description " )
70+ #else
71+ return " Couldn’t parse METAR or TAF. "
72+ #endif
6573 }
6674 }
6775
6876 public var failureReason : String ? {
6977 switch self {
7078 case . badFormat:
79+ #if canImport(Darwin)
7180 return String ( localized: " METAR or TAF format is incorrect. " , comment: " failure reason " )
81+ #else
82+ return " METAR or TAF format is incorrect. "
83+ #endif
7284 case . invalidDate( let date) :
85+ #if canImport(Darwin)
7386 return String ( localized: " Invalid date ‘ \( date) ’. " , comment: " failure reason " )
87+ #else
88+ return " Invalid date ‘ \( date) ’. "
89+ #endif
7490 case . invalidWinds( let winds) :
91+ #if canImport(Darwin)
7592 return String ( localized: " Invalid winds ‘ \( winds) ’. " , comment: " failure reason " )
93+ #else
94+ return " Invalid winds ‘ \( winds) ’. "
95+ #endif
7696 case . invalidVisibility( let visibility) :
97+ #if canImport(Darwin)
7798 return String ( localized: " Invalid visibility ‘ \( visibility) ’. " , comment: " failure reason " )
99+ #else
100+ return " Invalid visibility ‘ \( visibility) ’. "
101+ #endif
78102 case . invalidWeather( let weather) :
103+ #if canImport(Darwin)
79104 return String ( localized: " Invalid weather ‘ \( weather) ’. " , comment: " failure reason " )
105+ #else
106+ return " Invalid weather ‘ \( weather) ’. "
107+ #endif
80108 case . invalidConditions( let conditions) :
109+ #if canImport(Darwin)
81110 return String ( localized: " Invalid conditions ‘ \( conditions) ’. " , comment: " failure reason " )
111+ #else
112+ return " Invalid conditions ‘ \( conditions) ’. "
113+ #endif
82114 case . invalidTempDewpoint( let temps) :
115+ #if canImport(Darwin)
83116 return String (
84117 localized: " Invalid temperature and dewpoint ‘ \( temps) ’. " ,
85118 comment: " failure reason "
86119 )
120+ #else
121+ return " Invalid temperature and dewpoint ‘ \( temps) ’. "
122+ #endif
87123 case . invalidAltimeter( let altimeter) :
124+ #if canImport(Darwin)
88125 return String (
89126 localized: " Invalid altimeter setting ‘ \( altimeter) ’. " ,
90127 comment: " failure reason "
91128 )
129+ #else
130+ return " Invalid altimeter setting ‘ \( altimeter) ’. "
131+ #endif
92132 case . invalidPeriod( let period) :
133+ #if canImport(Darwin)
93134 return String ( localized: " Invalid TAF period ‘ \( period) ’. " , comment: " failure reason " )
135+ #else
136+ return " Invalid TAF period ‘ \( period) ’. "
137+ #endif
94138 case . invalidWindshear( let windshear) :
139+ #if canImport(Darwin)
95140 return String (
96141 localized: " Invalid low-level windshear ‘ \( windshear) ’. " ,
97142 comment: " failure reason "
98143 )
144+ #else
145+ return " Invalid low-level windshear ‘ \( windshear) ’. "
146+ #endif
99147 case . invalidIcing( let icing) :
148+ #if canImport(Darwin)
100149 return String ( localized: " Invalid icing ‘ \( icing) ’ " , comment: " failure reason " )
150+ #else
151+ return " Invalid icing ‘ \( icing) ’ "
152+ #endif
101153 case . invalidTurbulence( let turbulence) :
154+ #if canImport(Darwin)
102155 return String ( localized: " Invalid turbulence ‘ \( turbulence) ’ " , comment: " failure reason " )
156+ #else
157+ return " Invalid turbulence ‘ \( turbulence) ’ "
158+ #endif
103159 case . invalidForecastTemperature( let temp) :
160+ #if canImport(Darwin)
104161 return String (
105162 localized: " Invalid forecast temperature ' \( temp) ' " ,
106163 comment: " failure reason "
107164 )
165+ #else
166+ return " Invalid forecast temperature ' \( temp) ' "
167+ #endif
108168 case . invalidWindsAloftHeader( let header) :
169+ #if canImport(Darwin)
109170 return String (
110171 localized: " Invalid winds aloft header ' \( header) '. " ,
111172 comment: " failure reason "
112173 )
174+ #else
175+ return " Invalid winds aloft header ' \( header) '. "
176+ #endif
113177 case . invalidWindsAloftGroup( let group) :
178+ #if canImport(Darwin)
114179 return String (
115180 localized: " Invalid winds aloft data group ' \( group) '. " ,
116181 comment: " failure reason "
117182 )
183+ #else
184+ return " Invalid winds aloft data group ' \( group) '. "
185+ #endif
118186 case . invalidWindsAloftColumns( let columns) :
187+ #if canImport(Darwin)
119188 return String (
120189 localized: " Invalid winds aloft column layout ' \( columns) '. " ,
121190 comment: " failure reason "
122191 )
192+ #else
193+ return " Invalid winds aloft column layout ' \( columns) '. "
194+ #endif
123195 }
124196 }
125197
126198 public var recoverySuggestion : String ? {
127199 switch self {
128200 case . invalidWindsAloftHeader, . invalidWindsAloftGroup, . invalidWindsAloftColumns:
201+ #if canImport(Darwin)
129202 return String (
130203 localized: " Verify the format of the Winds Aloft product. " ,
131204 comment: " recovery suggestion "
132205 )
206+ #else
207+ return " Verify the format of the Winds Aloft product. "
208+ #endif
133209 default :
210+ #if canImport(Darwin)
134211 return String (
135212 localized: " Verify the format of the METAR or TAF string. " ,
136213 comment: " recovery suggestion "
137214 )
215+ #else
216+ return " Verify the format of the METAR or TAF string. "
217+ #endif
138218 }
139219 }
140220}
0 commit comments