GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Error handling with promises by diogoosz · Pull Request #467 · javascript-tutorial/pt.javascript.info

Conversation

@diogoosz

@diogoosz diogoosz commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

Tradução do artigo "Error handling with promises" para o português, incluindo o exercício.

Conforme comentado na #1.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@diogoosz
Translate 'Error handling with promises' article to Portuguese
d4be610
@gabifs gabifs mentioned this pull request Nov 7, 2026
Portuguese Translation Progress #1
Open
gabifs
gabifs reviewed Nov 7, 2026
View reviewed changes
Comment thread 1-js/11-async/04-promise-error-handling/article.md Outdated
.then(() => {
// successful promise handlers, one or more
}); // without .catch at the end!
// tratadores de promessa bem-sucedidos, um ou mais

@gabifs gabifs Nov 7, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mudança de sentido: successful promise handlers aqui quer dizer tratadores de sucesso (os passados ao .then), não tratadores que "tiveram sucesso". "tratadores de promessa bem-sucedidos" muda o sentido e destoa do termo usado no resto do artigo ("tratador .then de sucesso", linhas 103/117/120).

Suggested change
// tratadores de promessa bem-sucedidos, um ou mais
// tratadores de sucesso da promessa, um ou mais

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread 1-js/11-async/04-promise-error-handling/article.md Outdated
## try..catch implícito

The code of a promise executor and promise handlers has an "invisible `try..catch`" around it. If an exception happens, it gets caught and treated as a rejection.
O código de um executor de promessa e dos tratadores de promessa tem um "try..catch invisível" ao redor dele. Se uma exceção acontece, ela é capturada e tratada como uma rejeição.

@gabifs gabifs Nov 7, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formatação de código perdida: o original é "invisible `try..catch`", com try..catch como código inline. A tradução removeu as crases, então try..catch aparece como texto comum. O mesmo acontece na linha 67 e em 01-error-async/solution.md linha 11. O resto do artigo (linhas 99, 101, 171) mantém try..catch como código.

Suggested change
O código de um executor de promessa e dos tratadores de promessa tem um "try..catch invisível" ao redor dele. Se uma exceção acontece, ela é capturada e tratada como uma rejeição.
O código de um executor de promessa e dos tratadores de promessa tem um "`try..catch` invisível" ao redor dele. Se uma exceção acontece, ela é capturada e tratada como uma rejeição.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread 1-js/11-async/04-promise-error-handling/article.md Outdated
```

The "invisible `try..catch`" around the executor automatically catches the error and turns it into rejected promise.
O "try..catch invisível" ao redor do executor captura o erro automaticamente e o transforma em uma promessa rejeitada.

@gabifs gabifs Nov 7, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mesmo problema da linha 45: as crases ao redor de try..catch foram removidas.

Suggested change
O "try..catch invisível" ao redor do executor captura o erro automaticamente e o transforma em uma promessa rejeitada.
O "`try..catch` invisível" ao redor do executor captura o erro automaticamente e o transforma em uma promessa rejeitada.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread 1-js/11-async/04-promise-error-handling/01-error-async/solution.md Outdated
```

As said in the chapter, there's an "implicit `try..catch`" around the function code. So all synchronous errors are handled.
Como dito no capítulo, existe um "try..catch implícito" ao redor do código da função. Então todos os erros síncronos são tratados.

@gabifs gabifs Nov 7, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

O original é "implicit `try..catch`"; as crases ao redor de try..catch foram removidas na tradução.

Suggested change
Como dito no capítulo, existe um "try..catch implícito" ao redor do código da função. Então todos os erros síncronos são tratados.
Como dito no capítulo, existe um "`try..catch` implícito" ao redor do código da função. Então todos os erros síncronos são tratados.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread 1-js/11-async/04-promise-error-handling/article.md Outdated
- O `.then` também captura erros da mesma forma, se receber o segundo argumento (que é o tratador de erro).
- Devemos colocar o `.catch` exatamente nos lugares onde queremos tratar erros e sabemos como tratá-los. O tratador deve analisar os erros (classes de erro personalizadas ajudam) e relançar os desconhecidos (talvez sejam erros de programação).
- Não tem problema não usar `.catch` de jeito nenhum, se não houver como se recuperar de um erro.
- Em qualquer caso, devemos ter o tratador do evento `unhandledrejection` (para navegadores, e equivalentes para outros ambientes) para rastrear erros não tratados e informar o usuário (e provavelmente nosso servidor) sobre eles, para que nosso app nunca "simplesmente morra".

@gabifs gabifs Nov 7, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CLAUDE.md: "avoid using foreign words: Words like timer, loop, inline should be avoided." app é um anglicismo; "aplicação" funciona aqui.

Suggested change
- Em qualquer caso, devemos ter o tratador do evento `unhandledrejection` (para navegadores, e equivalentes para outros ambientes) para rastrear erros não tratados e informar o usuário (e provavelmente nosso servidor) sobre eles, para que nosso app nunca "simplesmente morra".
- Em qualquer caso, devemos ter o tratador do evento `unhandledrejection` (para navegadores, e equivalentes para outros ambientes) para rastrear erros não tratados e informar o usuário (e provavelmente nosso servidor) sobre eles, para que nossa aplicação nunca "simplesmente morra".

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread 1-js/11-async/04-promise-error-handling/article.md Outdated
Em um `try..catch` normal, podemos analisar o erro e talvez relançá-lo se não puder ser tratado. A mesma coisa é possível com promessas.

If we `throw` inside `.catch`, then the control goes to the next closest error handler. And if we handle the error and finish normally, then it continues to the next closest successful `.then` handler.
Se dermos um `throw` dentro do `.catch`, o controle vai para o próximo tratador de erro mais próximo. E se tratarmos o erro e terminarmos normalmente, então ele continua para o próximo tratador `.then` de sucesso mais próximo.

@gabifs gabifs Nov 7, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundância: "o próximo tratador de erro mais próximo" repete a ideia (tradução literal de "next closest"). Basta "o tratador de erro mais próximo", como na linha 69.

Suggested change
Se dermos um `throw` dentro do `.catch`, o controle vai para o próximo tratador de erro mais próximo. E se tratarmos o erro e terminarmos normalmente, então ele continua para o próximo tratador `.then` de sucesso mais próximo.
Se dermos um `throw` dentro do `.catch`, o controle vai para o tratador de erro mais próximo. E se tratarmos o erro e terminarmos normalmente, então ele continua para o tratador `.then` de sucesso mais próximo.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread 1-js/11-async/04-promise-error-handling/article.md Outdated

if (error instanceof URIError) {
// handle it
// trata isso

@gabifs gabifs Nov 7, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: // handle it é imperativo (um marcador de "faça o tratamento aqui"). "trata isso" fica no indicativo e soa estranho; algo como "trate o erro aqui" fica mais natural.

Suggested change
// trata isso
// trate o erro aqui

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@diogoosz
Apply review suggestions from gabifs
e42f325
@diogoosz

diogoosz commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

Obrigado, @gabifs! Apliquei tudo: corrigi o sentido de "successful promise handlers" (tratadores de sucesso, não tratadores bem-sucedidos), devolvi as crases em try..catch nos três lugares, removi a redundância "próximo... mais próximo", traduzi o comentário imperativo "// handle it", e troquei "app" por "aplicação".

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gabifs
gabifs merged commit 46f93f7 into javascript-tutorial:master Nov 8, 2026
1 check passed

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@gabifs gabifs gabifs left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@diogoosz @gabifs
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.