Skip to content

Commit

Permalink
Added file and line to NIOAsyncWriterError description (#2693)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
stefanadranca committed Mar 26, 2024
1 parent 2d840c5 commit 05fbcac
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions Sources/NIOCore/AsyncSequences/NIOAsyncWriter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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)"
}
}

Expand Down

0 comments on commit 05fbcac

Please sign in to comment.