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 — Custom errors, extending Error by cortizg · Pull Request #184 · javascript-tutorial/es.javascript.info

Conversation

@cortizg

@cortizg cortizg commented May 12, 2020

Copy link
Copy Markdown
Contributor

No description provided.

Sorry, something went wrong.

Uh oh!

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

All reactions
@cortizg
1-10-2-eh Traducido 9
ef51ea4
1-10-2-eh Corregido 7
@javascript-translate-bot javascript-translate-bot added the review needed label May 12, 2020
@javascript-translate-bot
javascript-translate-bot requested a review from a team May 12, 2020 03:27
@iliakan iliakan mentioned this pull request May 12, 2020
Spanish Translation Progress #17
Open
@cortizg
Merge branch 'master' into es.javascript.info.1-10-2-eh
cc76fde
joaquinelio
joaquinelio requested changes Jun 28, 2020
View reviewed changes

@joaquinelio joaquinelio left a comment •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

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.

Casi, @cortizg. No me deja sugerir, pero podria hacer merge.
Sin embargo, hay tema de glosario, es decir discutible:
WRAPPING. Lo tradujiste como ajuste. Va mas o menos bien, muy entendible, pero en un momento habla de "excepciones de ajuste" como una tecnica generalizada, y eso me molesta, porque está dando un refuerzo a lo que es un WRAPPER: una función que envuelve otra, en unos lados tradujeron como ENVOLTORIO y otros como CONTENEDOR (que acá sonarían forzados). Yo prefería dejar el nombre "wrapper" o aclararlo, pero no sugiero nada y si acuerdan dejarlo así podés ignorar mi request change.
También faltaba 1 (un) acento pero perdí dónde. (No los veo si no hago zoom) No reharía el pr entero por eso.

Sorry, something went wrong.

Uh oh!

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

All reactions
@javascript-translate-bot javascript-translate-bot added changes requested and removed review needed labels Jun 28, 2020
@javascript-translate-bot

javascript-translate-bot commented Jun 28, 2020

Copy link
Copy Markdown

Please make the requested changes. After it, add a comment "/done".
Then I'll ask for a new review 👻

All reactions

Sorry, something went wrong.

Uh oh!

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

@cortizg

cortizg commented Jun 29, 2020

Copy link
Copy Markdown
Contributor Author

Casi, @cortizg. No me deja sugerir, pero podria hacer merge.
Sin embargo, hay tema de glosario, es decir discutible:
WRAPPING. Lo tradujiste como ajuste. Va mas o menos bien, muy entendible, pero en un momento habla de "excepciones de ajuste" como una tecnica generalizada, y eso me molesta, porque está dando un refuerzo a lo que es un WRAPPER: una función que envuelve otra, en unos lados tradujeron como ENVOLTORIO y otros como CONTENEDOR (que acá sonarían forzados). Yo prefería dejar el nombre "wrapper" o aclararlo, pero no sugiero nada y si acuerdan dejarlo así podés ignorar mi request change.
También faltaba 1 (un) acento pero perdí dónde. (No los veo si no hago zoom) No reharía el pr entero por eso.

Tienes razón, en su momento no vi el error: podria ser agrupamiento de excepciones, o Empacado de excepciones

All reactions

Sorry, something went wrong.

Uh oh!

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

cortizg
cortizg commented Jun 29, 2020
View reviewed changes

@cortizg cortizg left a comment •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor Author

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.

Corregido Excepciones de ajuste a Empacado de excepciones

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread 1-js/10-error-handling/2-custom-errors/article.md
Ahora los errores personalizados son mucho más cortos, especialmente `ValidationError`, ya que eliminamos la línea `"this.name = ..."` en el constructor.

## Wrapping exceptions
## Excepciones de ajuste

@cortizg cortizg Jun 29, 2020

Copy link
Copy Markdown
Contributor Author

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.

Empacado de excepciones

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread 1-js/10-error-handling/2-custom-errors/article.md
A menudo, la respuesta es "No": nos gustaría estar "un nivel por encima de todo eso". Solo queremos saber si hubo un "error de lectura de datos": el por qué ocurrió exactamente es a menudo irrelevante (el mensaje de error lo describe). O, mejor aún, nos gustaría tener una forma de obtener los detalles del error, pero solo si es necesario.

The technique that we describe here is called "wrapping exceptions".
La técnica que describimos aquí se llama "excepciones de ajuste".

@cortizg cortizg Jun 29, 2020

Copy link
Copy Markdown
Contributor Author

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.

La técnica que describimos aquí se llama "empacado de excepciones".

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread 1-js/10-error-handling/2-custom-errors/article.md
Entonces, el código externo verifica `instanceof ReadError` y eso es todo. No es necesario enumerar todos los tipos de error posibles.

The approach is called "wrapping exceptions", because we take "low level" exceptions and "wrap" them into `ReadError` that is more abstract. It is widely used in object-oriented programming.
El enfoque se llama "excepciones de ajuste", porque tomamos excepciones de "bajo nivel" y las "ajustamos" en `ReadError` que es más abstracto. Es ampliamente utilizado en la programación orientada a objetos.

@cortizg cortizg Jun 29, 2020

Copy link
Copy Markdown
Contributor Author

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.

El enfoque se llama "empacado de excepciones", porque tomamos excepciones de "bajo nivel" y las "empacamos" dentro de ReadError que es más abstracto. Es ampliamente utilizado en la programación orientada a objetos.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread 1-js/10-error-handling/2-custom-errors/article.md
- Wrapping exceptions is a widespread technique: a function handles low-level exceptions and creates higher-level errors instead of various low-level ones. Low-level exceptions sometimes become properties of that object like `err.cause` in the examples above, but that's not strictly required.
- Podemos heredar de `Error` y otras clases de error incorporadas normalmente. Solo necesitamos cuidar la propiedad `name` y no olvidemos llamar `super`.
- Podemos usar `instanceof` para verificar errores particulares. También funciona con herencia. Pero a veces tenemos un objeto error que proviene de una biblioteca de terceros y no hay una manera fácil de obtener su clase. Entonces la propiedad `name` puede usarse para tales controles.
- Excepciones de Ajustes es una técnica generalizada: una función maneja excepciones de bajo nivel y crea errores de alto nivel en lugar de varios errores de bajo nivel. Las excepciones de bajo nivel a veces se convierten en propiedades de ese objeto como `err.cause` en los ejemplos anteriores, pero eso no es estrictamente necesario. No newline at end of file

@cortizg cortizg Jun 29, 2020

Copy link
Copy Markdown
Contributor Author

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.

Empacado de excepciones es una técnica generalizada: una función maneja excepciones de bajo nivel y crea errores de alto nivel en lugar de varios errores de bajo nivel. Las excepciones de bajo nivel a veces se convierten en propiedades de ese objeto como err.cause en los ejemplos anteriores, pero eso no es estrictamente necesario.

Sorry, something went wrong.

Uh oh!

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

All reactions
@cortizg

cortizg commented Jun 29, 2020

Copy link
Copy Markdown
Contributor Author

Lo cierro por rama eliminada...

All reactions

Sorry, something went wrong.

Uh oh!

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

@cortizg cortizg closed this Jun 29, 2020
@cortizg cortizg mentioned this pull request Jun 29, 2020
Custom errors, extending Error #285
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@joaquinelio joaquinelio joaquinelio requested changes

Uh oh!

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

Assignees

No one assigned

Labels

changes requested

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.

3 participants

@cortizg @javascript-translate-bot @joaquinelio
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.