Skip to content

Commit

Permalink
Do not render empty event stream errors (#2200)
Browse files Browse the repository at this point in the history
Signed-off-by: Daniele Ahmed <[email protected]>
  • Loading branch information
82marbag authored Jan 18, 2023
1 parent b08c061 commit a0b2ac6
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -487,13 +487,15 @@ open class ServerCodegenVisitor(
}

if (shape.isEventStream()) {
rustCrate.withModule(RustModule.Error) {
val symbol = codegenContext.symbolProvider.toSymbol(shape)
val errors = shape.eventStreamErrors()
.map { model.expectShape(it.asMemberShape().get().target, StructureShape::class.java) }
val errorSymbol = shape.eventStreamErrorSymbol(codegenContext.symbolProvider)
ServerOperationErrorGenerator(model, codegenContext.symbolProvider, symbol, errors)
.renderErrors(this, errorSymbol, symbol)
val errors = shape.eventStreamErrors()
.map { model.expectShape(it.asMemberShape().get().target, StructureShape::class.java) }
if (errors.isNotEmpty()) {
rustCrate.withModule(RustModule.Error) {
val symbol = codegenContext.symbolProvider.toSymbol(shape)
val errorSymbol = shape.eventStreamErrorSymbol(codegenContext.symbolProvider)
ServerOperationErrorGenerator(model, codegenContext.symbolProvider, symbol, errors)
.renderErrors(this, errorSymbol, symbol)
}
}
}
}
Expand Down

0 comments on commit a0b2ac6

Please sign in to comment.