diff --git a/Sources/DataLiteCore/Classes/Connection.swift b/Sources/DataLiteCore/Classes/Connection.swift index 0e26862..fdfe41b 100644 --- a/Sources/DataLiteCore/Classes/Connection.swift +++ b/Sources/DataLiteCore/Classes/Connection.swift @@ -48,8 +48,6 @@ public final class Connection { /// Initializes a new connection to an SQLite database. /// /// Opens a connection to the database at the specified `location` using the given `options`. - /// If the location represents a file path, this method ensures that the parent directory - /// exists, creating intermediate directories if needed. /// /// ### Example /// @@ -73,15 +71,7 @@ public final class Connection { /// /// - Throws: ``SQLiteError`` if the connection cannot be opened or initialized due to /// SQLite-related issues such as invalid path, missing permissions, or corruption. - /// - Throws: An error if directory creation fails for file-based database locations. - public init(location: Location, options: Options) throws { - if case let Location.file(path) = location, !path.isEmpty { - try FileManager.default.createDirectory( - at: URL(fileURLWithPath: path).deletingLastPathComponent(), - withIntermediateDirectories: true - ) - } - + public init(location: Location, options: Options) throws(SQLiteError) { var connection: OpaquePointer! = nil let status = sqlite3_open_v2(location.path, &connection, options.rawValue, nil) @@ -121,8 +111,7 @@ public final class Connection { /// /// - Throws: ``SQLiteError`` if the connection cannot be opened due to SQLite-level errors, /// invalid path, missing permissions, or corruption. - /// - Throws: An error if the required directory structure cannot be created. - public convenience init(path: String, options: Options) throws { + public convenience init(path: String, options: Options) throws(SQLiteError) { try self.init(location: .file(path: path), options: options) } diff --git a/Sources/DataLiteCore/Docs.docc/Articles/ErrorHandling.md b/Sources/DataLiteCore/Docs.docc/Articles/ErrorHandling.md index 3deded9..9ef2338 100644 --- a/Sources/DataLiteCore/Docs.docc/Articles/ErrorHandling.md +++ b/Sources/DataLiteCore/Docs.docc/Articles/ErrorHandling.md @@ -25,9 +25,8 @@ SQLite messages verbatim. Most DataLiteCore APIs are annotated as `throws(SQLiteError)`, meaning they only throw SQLiteError instances. -Only APIs that touch the file system or execute arbitrary user code may throw other error -types — for example, ``Connection/init(location:options:)`` when creating directories for on-disk -databases. +Only APIs that execute arbitrary user code or integrate with external systems may surface other +error types. Consult the documentation on each API for specific details. ```swift do {