- Add Pdftract.swift.tera for main public API with type aliases - Update Methods.swift.tera with async throws functions and AsyncThrowingStream for streaming - Update Errors.swift.tera with 8 error types implementing LocalizedError - Update Types.swift.tera with Source enum, Options structs, and all Codable types - Update ConformanceTests.swift.tera with XCTest-based conformance suite - Update README.md.tera with full documentation (install, usage, error handling) - Update Package.swift.tera with macOS(.v13) and Linux platform support Closes pdftract-5lvpu
75 lines
1.6 KiB
Text
75 lines
1.6 KiB
Text
//
|
|
// This file is auto-generated. Do not edit manually.
|
|
//
|
|
|
|
#if os(Linux)
|
|
import Foundation
|
|
#else
|
|
import Foundation
|
|
#endif
|
|
|
|
/// Base error type for all Pdftract errors.
|
|
public struct PdftractError: Error, LocalizedError {
|
|
public let message: String
|
|
public let exitCode: Int
|
|
|
|
public init(_ message: String, _ exitCode: Int) {
|
|
self.message = message
|
|
self.exitCode = exitCode
|
|
}
|
|
|
|
public var errorDescription: String? {
|
|
return message
|
|
}
|
|
|
|
public var localizedDescription: String {
|
|
return message
|
|
}
|
|
}
|
|
|
|
{% for error in errors %}
|
|
{% if error.exit_code != 0 and error.exit_code != 10 %}
|
|
/// {{ error.description }}
|
|
public struct {{ error.exception_name }}: Error, LocalizedError {
|
|
public let message: String
|
|
public let exitCode: Int
|
|
|
|
public init(_ message: String, _ exitCode: Int) {
|
|
self.message = message
|
|
self.exitCode = exitCode
|
|
}
|
|
|
|
public var errorDescription: String? {
|
|
return message
|
|
}
|
|
|
|
public var localizedDescription: String {
|
|
return message
|
|
}
|
|
}
|
|
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% for error in errors %}
|
|
{% if error.exit_code == 10 %}
|
|
/// {{ error.description }}
|
|
public struct {{ error.exception_name }}: Error, LocalizedError {
|
|
public let message: String
|
|
public let exitCode: Int
|
|
|
|
public init(_ message: String, _ exitCode: Int) {
|
|
self.message = message
|
|
self.exitCode = exitCode
|
|
}
|
|
|
|
public var errorDescription: String? {
|
|
return message
|
|
}
|
|
|
|
public var localizedDescription: String {
|
|
return message
|
|
}
|
|
}
|
|
|
|
{% endif %}
|
|
{% endfor %}
|