Skip to content

ambiguous paragraphs on Custom errors chapter #1808

@Violet-Bora-Lee

Description

@Violet-Bora-Lee

Hi.

I'm translating https://javascript.info/custom-errors.

I've tried to understand below two paragraphs but I couldn't.

I think my English reading skills might be not that good to understand sentences yet.

Could you elaborate more especially the first paragraph?

Often the answer is “No”: the outer code wants to be “one level above all that”, it just wants to have some kind of “data reading error” – why exactly it happened is often irrelevant (the error message describes it). Or, even better, it could have a way to get the error details, but only if we need to.

So let’s make a new class ReadError to represent such errors. If an error occurs inside readUser, we’ll catch it there and generate ReadError. We’ll also keep the reference to the original error in its cause property. Then the outer code will only have to check for ReadError.

Q1. What is outer code on "the outer code wants to be"? Outer of what?
Q2. What THAT means on "one level above all that"?
Q3. Does IT mean outer code on "it just wants to have..."?
Q4. What IT means on "why exactly it happened..."?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions