File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
Sources/LiveViewNative/Coordinators Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -238,7 +238,11 @@ public class LiveSessionCoordinator<R: RootRegistry>: ObservableObject {
238
238
if let cachedStylesheet = await StylesheetCache . shared. read ( for: url, registry: R . self) {
239
239
return cachedStylesheet
240
240
} else {
241
- let ( data, _) = try await self . urlSession. data ( from: url)
241
+ let ( data, response) = try await self . urlSession. data ( from: url)
242
+ if let response = response as? HTTPURLResponse ,
243
+ !( 200 ... 299 ) . contains ( response. statusCode) {
244
+ throw AnyLocalizedError ( errorDescription: " Downloading stylesheet ' \( url. absoluteString) ' failed with status code \( response. statusCode) " )
245
+ }
242
246
guard let contents = String ( data: data, encoding: . utf8)
243
247
else { return await Stylesheet < R > ( content: [ ] , classes: [ : ] ) }
244
248
let stylesheet = try await Stylesheet < R > ( from: contents, in: . init( ) )
You can’t perform that action at this time.
0 commit comments