Repository: node
Issue: awaiting some fs/promises API (readdir, readfile) breaks later try catch block
Labels: promises,errors

### Version

v16.15.0, v20.10.0

### Platform

Darwin Guang-Yu-Huang-Frank 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:59:33 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T8112 arm64

### Subsystem

_No response_

### What steps will reproduce the bug?

## Steps

### Init a new project
```sh
$ npm init -y
```

### Install fs
```sh
$ npm install fs
```

### Modify package.json
add `"type": "module",` in package.json

```json
{
  "name": "cli",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "type": "module",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "fs": "^0.0.1-security"
  }
}
```

### Copy code in one of the following cases to created file

### Execute

## Case 1: The promise is created before the first try-catch

### Code
```javascript
import { readdir } from 'fs/promises';

const main = async () => {
  const p = Promise.reject('test error');

  try {
    await readdir('.');
  } catch (error) {
    console.error('first promise rejected');
  }

  try {
    await p;
  } catch (error) {
    console.error('second promise rejected');
  }
};

main();
```

### Result
<img width="734" alt="image" src="https://github.com/nodejs/node/assets/28520632/b39bc443-7add-4ef0-ba75-6db4f5a68f7d">

## Case 2: The promise is created after the first try-catch

### Code
```javascript
import { readdir } from 'fs/promises';

const main = async () => {
  try {
    await readdir('.');
  } catch (error) {
    console.error('first promise rejected');
  }
  
  const p = Promise.reject('test error');

  try {
    await p;
  } catch (error) {
    console.error('second promise rejected');
  }
};

main();
```

### Result
<img width="721" alt="image" src="https://github.com/nodejs/node/assets/28520632/15d79def-7310-4dfa-9dd0-3f03d5b2c04a">

## Case 3: The promise is created before the first try-catch & not using readdir 

### Code
```javascript
const main = async () => {
  const p = Promise.reject('test error');

  try {
    await Promise.resolve('test success');
  } catch (error) {
    console.error('first promise rejected');
  }

  try {
    await p;
  } catch (error) {
    console.error('second promise rejected');
  }
};

main();
```

### Result
<img width="655" alt="image" src="https://github.com/nodejs/node/assets/28520632/44749570-8298-40b1-8b16-f8097d9c14ac">

## Conclusion

Somehow, the order of creation of the promise affects the behavior of the second try-catch block

### How often does it reproduce? Is there a required condition?

100% on my and my co-workers' computers (all macOS)

### What is the expected behavior? Why is that the expected behavior?

The second try-catch block should always catch the error, regardless of the order of creation

### What do you see instead?

The second try-catch block doesn't catch the error when the promise is created before the first try-catch block

### Additional information

_No response_