Skip to content

Commit

Permalink
Tweak the docs on the errors throw.
Browse files Browse the repository at this point in the history
Don't call out too specific of things and instead just mention the Errors types
that are possible to avoid being overly specific and leading folks in the wrong
direction.
  • Loading branch information
thomasvl committed Aug 24, 2023
1 parent 618433a commit 78a6260
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
18 changes: 6 additions & 12 deletions Sources/SwiftProtobuf/AsyncMessageSequence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,9 @@ extension AsyncSequence where Element == UInt8 {
/// `BinaryDecodingError.missingRequiredFields` will be thrown.
/// - options: The BinaryDecodingOptions to use.
/// - Returns: An asynchronous sequence of messages read from the `AsyncSequence` of bytes.
/// - Throws: `BinaryDecodingError` if decoding fails, throws
/// `BinaryDelimited.Error` for some reading errors,
/// `BinaryDelimited.Error.truncated` if the stream ends before fully decoding a
/// message or a delimiter,
/// `BinaryDelimited.Error.malformedLength`if a delimiter could not be read and
/// `BinaryDecodingError.tooLarge` if a size delimiter of 2GB or greater is found.
/// - Throws: `BinaryDelimited.Error` for errors in the framing of the messages
/// in the sequence, `BinaryDecodingError` for errors while decoding
/// messages.
@inlinable
public func binaryProtobufDelimitedMessages<M: Message>(
of messageType: M.Type = M.self,
Expand Down Expand Up @@ -78,12 +75,9 @@ public struct AsyncMessageSequence<
/// `BinaryDecodingError.missingRequiredFields` will be thrown.
/// - options: The BinaryDecodingOptions to use.
/// - Returns: An asynchronous sequence of messages read from the `AsyncSequence` of bytes.
/// - Throws: `BinaryDecodingError` if decoding fails, throws
/// `BinaryDelimited.Error` for some reading errors,
/// `BinaryDelimited.Error.truncated` if the stream ends before fully decoding a
/// message or a delimiter,
/// `BinaryDelimited.Error.malformedLength`if a delimiter could not be read and
/// `BinaryDecodingError.tooLarge` if a size delimiter of 2GB or greater is found.
/// - Throws: `BinaryDelimited.Error` for errors in the framing of the messages
/// in the sequence, `BinaryDecodingError` for errors while decoding
/// messages.
public init(
base: Base,
extensions: ExtensionMap? = nil,
Expand Down
4 changes: 2 additions & 2 deletions Sources/SwiftProtobuf/BinaryDelimited.swift
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public enum BinaryDelimited {
/// - Returns: The message read.
/// - Throws: `BinaryDecodingError` if decoding fails, throws
/// `BinaryDelimited.Error` for some reading errors, and the
/// underlying InputStream.streamError for a stream error.
/// underlying `InputStream.streamError` for a stream error.
public static func parse<M: Message>(
messageType: M.Type,
from stream: InputStream,
Expand Down Expand Up @@ -164,7 +164,7 @@ public enum BinaryDelimited {
/// - options: The BinaryDecodingOptions to use.
/// - Throws: `BinaryDecodingError` if decoding fails, throws
/// `BinaryDelimited.Error` for some reading errors, and the
/// underlying InputStream.streamError for a stream error.
/// underlying `InputStream.streamError` for a stream error.
public static func merge<M: Message>(
into message: inout M,
from stream: InputStream,
Expand Down

0 comments on commit 78a6260

Please sign in to comment.