Skip to content

Commit

Permalink
fix: handle not-found policies for EventBridge schema registries
Browse files Browse the repository at this point in the history
  • Loading branch information
willdady committed Apr 11, 2022
1 parent a3e0c15 commit 7120a65
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/schemas/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
GetResourcePolicyCommand,
NotFoundException,
paginateListRegistries,
RegistrySummary,
SchemasClient,
Expand Down Expand Up @@ -38,7 +39,15 @@ export class EventBridgeSchemasPolicyCollector extends BasePolicyCollector {
for (const r of registries) {
// NOTE: Can not read policies of AWS managed registries
if (r.RegistryName!.startsWith('aws.')) continue;
const response = await this.getResourcePolicy(r.RegistryName!);
let response;
try {
response = await this.getResourcePolicy(r.RegistryName!);
} catch (err) {
if (err instanceof NotFoundException) {
continue;
}
throw err;
}
if (!response.Policy) continue;
result.resources.push({
type: 'AWS::EventSchemas::Registry',
Expand Down

0 comments on commit 7120a65

Please sign in to comment.