Skip to content

Commit

Permalink
do not reexport base exception for ssdk; export base exception in cli…
Browse files Browse the repository at this point in the history
…ent with prefix
  • Loading branch information
AllanZhengYP committed Feb 17, 2022
1 parent 029afe1 commit 98ceb16
Showing 1 changed file with 8 additions and 5 deletions.
Expand Up @@ -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;
Expand All @@ -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);
}
}
}

0 comments on commit 98ceb16

Please sign in to comment.