Skip to content

Exceptions with constructor default values are copied incorrectly #987

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

Closed
GerritKopp opened this issue Feb 15, 2019 · 0 comments
Closed
Assignees
Labels

Comments

@GerritKopp
Copy link

While writing an application with Ktor, I noticed that exceptions are copied with the wrong message when the exception has a constructor parameter with a default value:

When you have a class like

class MyException(message: String = "Default message") : RuntimeException(message)

and throw an exception with a custom message

throw MyException("Custom message")

and tryCopyException() in ExceptionsConstuctor.kt is called, the resulting exception will contain the message Default message instead of Custom message.

Sample Ktor project with test cases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants