# Nodejs ile ele alinmamis promise.rejectleri yakamalar

![](https://i.imgur.com/brhg2zy.png)

* `process.on` ile yakalayabiliriz
* Bu örnekte, `new Promise` içindeki işlev hemen bir hata ile reddedilir, ancak bu hata hiçbir yerde yakalanmaz. Bu durumda, 'unhandledRejection' olayı tetiklenir ve belirtilen işlev çalıştırılır. Bu işlev, reddedilen promise'i ve reddetme nedenini konsola yazar.

```python
process.on('unhandledRejection', (reason, promise) => {
  console.log('Unhandled Rejection at:', promise, 'reason:', reason);
  // Application specific logging, throwing an error, or other logic here
});

new Promise((resolve, reject) => {
  reject(new Error('Test Error'));
});
```

![](https://i.imgur.com/mnFuDwn.png)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.yemreak.com/arsiv/programming/nodejs-ile-ele-alinmamis-promiserejectleri-yakamalar.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
