Skip to content

Instanceof Error not working #6884

@aleguern-azivko

Description

@aleguern-azivko

Checkboxes for prior research

Describe the bug

The AWS SDK v3 type definitions for EventBridge Scheduler's ResourceNotFoundException are not properly exposed, forcing unsafe type casting to handle this common error case.

Current workaround:

if ((error as any).name === 'ResourceNotFoundException')

Regression Issue

  • Select this option if this issue appears to be a regression.

SDK version number

@aws-sdk/client-scheduler: ^3.716.0

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

22

Reproduction Steps

import { ResourceNotFoundException, GetScheduleCommand } from '@aws-sdk/client-scheduler';

try {
  await scheduler.send(new GetScheduleCommand({ Name: 'non-existent' }));
} catch (error) {
  // Have to use unsafe casting
  if (error instanceof ResourceNotFoundException) {
    // Handle missing schedule
   console.log("hello world")
  }
}

Observed Behavior

ResourceNotFoundException: Schedule non-existent does not exist.

Expected Behavior

logging hello worl

Possible Solution

No response

Additional Information/Context

No response

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.p2This is a standard priority issueresponse-requestedWaiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions