Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-7652] Error bridged to NSError's description doesn't use my CustomStringConvertible instance's description #50193

Closed
weissi opened this issue May 10, 2018 · 4 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. runtime The Swift Runtime standard library Area: Standard library umbrella

Comments

@weissi
Copy link
Member

weissi commented May 10, 2018

Previous ID SR-7652
Radar None
Original Reporter @weissi
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Bug, Runtime
Assignee @theblixguy
Priority Medium

md5: 839f0bcd698aa191bfb33d06fa2cd5ce

Issue Description:

from a very recent Swift 4.2 snapshot on Darwin:

  1> import Foundation
  2> struct MyError: Error, CustomStringConvertible { let description = "this is the right description" }
  3> print((MyError() as NSError).description)
Error Domain=__lldb_expr_3.MyError Code=1 "(null)"

I think this definitely should print the description of MyError instead of the not so useful default NSError description

@lorentey
Copy link
Member

I think we should provide a custom implementation for -[_SwiftNativeNSError description] in the runtime, calling swift::getDescription on the native error value.

@weissi
Copy link
Member Author

weissi commented Oct 6, 2019

this is still an issue:

  8> print(IOError(errnoCode: 2, function: "foo") as NSError)
Error Domain=NIO.IOError Code=1 "(null)"
  9> print(IOError(errnoCode: 2, function: "foo"))
foo failed: No such file or directory (errno: 2)

@theblixguy
Copy link
Collaborator

#29224

@theblixguy
Copy link
Collaborator

Fixed on master. Please verify using the next available snapshot!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. runtime The Swift Runtime standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

3 participants