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
This commit is contained in:
Stefana-Ioana Dranca authored and GitHub committed 2024-03-26 06:53:14 -07:00
1 parent 2d840c586f
commit 05fbcace24
1 file changed
+3 -5
@@ -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)"
}
}