From 05fbcace24afbf36ed9b7103f13e59fea88addf8 Mon Sep 17 00:00:00 2001 From: Stefana-Ioana Dranca <66513820+stefanadranca@users.noreply.github.com> Date: Tue, 26 Mar 2024 13:53:14 +0000 Subject: [PATCH] Added file and line to NIOAsyncWriterError description (#2693) Motivation: Even though NIOAsyncWriterError captures the file and line of the error they are internal and not printed in the description. Modifications: - made the 2 properties public - added them in the description Result: Users will be able to access and see the line number and file where a NIOAsyncWriterError occurred --- Sources/NIOCore/AsyncSequences/NIOAsyncWriter.swift | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Sources/NIOCore/AsyncSequences/NIOAsyncWriter.swift b/Sources/NIOCore/AsyncSequences/NIOAsyncWriter.swift index 8215a4e39..f0fc90378 100644 --- a/Sources/NIOCore/AsyncSequences/NIOAsyncWriter.swift +++ b/Sources/NIOCore/AsyncSequences/NIOAsyncWriter.swift @@ -80,11 +80,9 @@ public struct NIOAsyncWriterError: Error, Hashable, CustomStringConvertible { @usableFromInline let _code: _Code - @usableFromInline - var file: String + public var file: String - @usableFromInline - var line: Int + public var line: Int @inlinable init(_code: _Code, file: String, line: Int) { @@ -111,7 +109,7 @@ public struct NIOAsyncWriterError: Error, Hashable, CustomStringConvertible { @inlinable public var description: String { - "NIOAsyncWriterError.\(self._code.rawValue)" + "NIOAsyncWriterError.\(self._code.rawValue): \(self.file):\(self.line)" } }