Skip to content

Smithy4sThrowable toString ignores fields if message is present #1805

@kubukoz

Description

@kubukoz

When you generate code from this:

$version: "2"

namespace input

@error("client")
structure Foo {
  @smithy4s.meta#errorMessage message: String
  @required extra: String
} 

if message is present, you won't see extra:

println(input.Foo(extra = "important details", message = Some("failure!")))
// input.Foo: failure!

println(input.Foo(extra = "important details", message = None))
// input.Foo(important details, None)

This can be really confusing, e.g. in tests that are based on equals + toString, which is the default Weaver behavior if you don't have a Comparison instance - your test will fail, but you won't see a diff, because only the message is part of the toString.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions