-
Notifications
You must be signed in to change notification settings - Fork 68
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
Throwable toString override #1263
Conversation
c5a55ef
to
fd94ab7
Compare
@@ -801,6 +802,10 @@ private[internals] class Renderer(compilationUnit: CompilationUnit) { self => | |||
) | |||
} | |||
|
|||
// Default toString on Throwable prints the classname, instead we use the case class toString. | |||
private def defaultThrowableGetMessage = | |||
line"override def toString(): $string_ = $scalaRuntime._toString(this)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for reviewing this only now. Anyway, the documentation of the ScalaRunTime object states the following :
/** The object ScalaRunTime provides support methods required by
* the scala runtime. All these methods should be considered
* outside the API and subject to change or removal without notice.
*/
therefore, I'm not comfortable with this implementation. Can you elaborate on the rationale for wanting to use this ? I guess it's just for the convenience of it.
In any case, we can render an actual implementation that'd be using a StringBuilder quite easily.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed that completely, that's fair.
In any case, we can render an actual implementation that'd be using a StringBuilder quite easily.
Any format we prefer? For Foo(bar: String)
, default implementation renders Foo(barValue)
, we can choose how to render if we implement it ourselves
This reverts commit 831d99c.
Conflicts: CHANGELOG.md
I chose to implement toString, because implementing getMessage would lead to `smithy4s.example.ClientError: smithy4s.example.ClientError(400, "oops")` which felt weird
e886e5d
to
2f51c44
Compare
Default
toString
onThrowable
prints the classname. This is suboptimal when we could have the case classtoString
implementation available.PR Checklist (not all items are relevant to all PRs)