Skip to content

Commit 98ceb16

Browse files
committed
do not reexport base exception for ssdk; export base exception in client with prefix
1 parent 029afe1 commit 98ceb16

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/AddBaseExceptionClassExport.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515

1616
package software.amazon.smithy.typescript.codegen.integration;
1717

18+
import software.amazon.smithy.codegen.core.Symbol;
1819
import software.amazon.smithy.codegen.core.SymbolProvider;
1920
import software.amazon.smithy.model.Model;
21+
import software.amazon.smithy.model.shapes.ServiceShape;
2022
import software.amazon.smithy.typescript.codegen.TypeScriptDependency;
2123
import software.amazon.smithy.typescript.codegen.TypeScriptSettings;
2224
import software.amazon.smithy.typescript.codegen.TypeScriptWriter;
@@ -35,11 +37,12 @@ public void writeAdditionalExports(
3537
SymbolProvider symbolProvider,
3638
TypeScriptWriter writer
3739
) {
38-
boolean isServerSdk = settings.generateServerSdk();
39-
if (isServerSdk) {
40-
writer.write("export {SmithyException} from $S;", TypeScriptDependency.SERVER_COMMON.packageName);
41-
} else {
42-
writer.write("export { ServiceException } from $S;", TypeScriptDependency.AWS_SMITHY_CLIENT.packageName);
40+
boolean isClientSdk = settings.generateClient();
41+
if (isClientSdk) {
42+
ServiceShape service = settings.getService(model);
43+
Symbol symbol = symbolProvider.toSymbol(service);
44+
writer.write("export { ServiceException as $LServiceException } from $S;", symbol.getName(),
45+
TypeScriptDependency.AWS_SMITHY_CLIENT.packageName);
4346
}
4447
}
4548
}

0 commit comments

Comments
 (0)