Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update copyright year, refine error handling
  • Loading branch information
MaxDesiatov committed Aug 2, 2023
commit fb38bef48bbdebbb0ad05409fdf3cdb8c95bde18
9 changes: 5 additions & 4 deletions Sources/SwiftDocC/Indexing/Navigator/NavigatorTree.swift
Original file line number Diff line number Diff line change
Expand Up @@ -324,13 +324,14 @@ public class NavigatorTree {
presentationIdentifier: String? = nil,
onNodeRead: ((NavigatorTree.Node) -> Void)? = nil
) throws -> NavigatorTree {
guard
let fileHandle = FileHandle(forReadingAtPath: path),
let data = try fileHandle.readToEnd()
else {
guard let fileHandle = FileHandle(forReadingAtPath: path) else {
throw Error.cannotOpenFile(path: path)
}

guard let data = try fileHandle.readToEnd() else {
throw FileSystemError.noDataReadFromFile(path: path)
}

var map = [UInt32: Node]()
var index: UInt32 = 0
var cursor = 0
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftDocC/Utility/Errors/FileSystemError.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
This source file is part of the Swift.org open source project

Copyright (c) 2021 Apple Inc. and the Swift project authors
Copyright (c) 2023 Apple Inc. and the Swift project authors
Licensed under Apache License v2.0 with Runtime Library Exception

See https://swift.org/LICENSE.txt for license information
Expand Down