Show errors during loading

This commit is contained in:
Christoph Hagen
2025-01-09 09:31:05 +01:00
parent a7197b9628
commit 93c8d06f23
12 changed files with 97 additions and 39 deletions

View File

@ -105,6 +105,12 @@ final class LoadingContext {
return nil
}
return tagOverview
case .file:
guard let id = itemId.id else {
error("Missing file id in itemId")
return nil
}
return file(id)
}
}
}

View File

@ -1,4 +1,17 @@
final class LoadingErrorHandler: SecurityBookmarkErrorDelegate {
let context: LoadingContext
init(context: LoadingContext) {
self.context = context
}
func securityBookmark(error: String) {
context.error("\(error)")
}
}
final class ModelLoader {
let content: Content
@ -7,10 +20,14 @@ final class ModelLoader {
let context: LoadingContext
let errorHandler: LoadingErrorHandler
init(content: Content, storage: Storage) {
self.content = content
self.storage = storage
self.context = .init(content: content)
self.errorHandler = .init(context: context)
storage.contentScope?.delegate = errorHandler
}
func load() -> LoadingResult {