From 98ceb160b23ca999400140368dfdd03adf0178ca Mon Sep 17 00:00:00 2001 From: AllanZhengYP Date: Thu, 17 Feb 2022 01:22:54 +0000 Subject: [PATCH] do not reexport base exception for ssdk; export base exception in client with prefix --- .../integration/AddBaseExceptionClassExport.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/AddBaseExceptionClassExport.java b/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/AddBaseExceptionClassExport.java index c0fbd71ab74..5cde99c2ca3 100644 --- a/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/AddBaseExceptionClassExport.java +++ b/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/AddBaseExceptionClassExport.java @@ -15,8 +15,10 @@ package software.amazon.smithy.typescript.codegen.integration; +import software.amazon.smithy.codegen.core.Symbol; import software.amazon.smithy.codegen.core.SymbolProvider; import software.amazon.smithy.model.Model; +import software.amazon.smithy.model.shapes.ServiceShape; import software.amazon.smithy.typescript.codegen.TypeScriptDependency; import software.amazon.smithy.typescript.codegen.TypeScriptSettings; import software.amazon.smithy.typescript.codegen.TypeScriptWriter; @@ -35,11 +37,12 @@ public void writeAdditionalExports( SymbolProvider symbolProvider, TypeScriptWriter writer ) { - boolean isServerSdk = settings.generateServerSdk(); - if (isServerSdk) { - writer.write("export {SmithyException} from $S;", TypeScriptDependency.SERVER_COMMON.packageName); - } else { - writer.write("export { ServiceException } from $S;", TypeScriptDependency.AWS_SMITHY_CLIENT.packageName); + boolean isClientSdk = settings.generateClient(); + if (isClientSdk) { + ServiceShape service = settings.getService(model); + Symbol symbol = symbolProvider.toSymbol(service); + writer.write("export { ServiceException as $LServiceException } from $S;", symbol.getName(), + TypeScriptDependency.AWS_SMITHY_CLIENT.packageName); } } }