Save automatically, improve mocks
This commit is contained in:
@@ -29,7 +29,7 @@ final class LoadingContext {
|
||||
tags: tags.values.sorted(),
|
||||
files: files.values.sorted { $0.id },
|
||||
tagOverview: tagOverview,
|
||||
errors: errors.sorted())
|
||||
errors: errors.sorted().map { StorageError(message: $0) })
|
||||
}
|
||||
|
||||
func error(_ message: String) {
|
||||
|
@@ -13,5 +13,5 @@ struct LoadingResult {
|
||||
|
||||
let tagOverview: Tag?
|
||||
|
||||
let errors: [String]
|
||||
let errors: [StorageError]
|
||||
}
|
||||
|
@@ -1,17 +1,4 @@
|
||||
|
||||
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
|
||||
@@ -20,14 +7,10 @@ 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 {
|
||||
|
Reference in New Issue
Block a user