Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom-error-definition - Fix null reference #188

Merged

Conversation

MrHen
Copy link
Contributor

@MrHen MrHen commented Sep 2, 2018

Fixes #150.

I did NOT try to verify that the name used was correct (e.g. export.FooError versus export.foo). I just fixed the null ref.

As of this PR, these cases will all pass:

exports.fooError = class extends Error {
    constructor(error) {
        super(error);
    }
};

exports.fooError = class extends Error {
    constructor(error) {
        super(error);
        this.name = 'fooError';
    }
};

exports.fooError = class FooError extends Error {
    constructor(error) {
        super(error);
        this.name = 'FooError';
    }
};

@MrHen MrHen changed the title Fix null reference custom-error-definition - fix null ref Sep 2, 2018
@sindresorhus
Copy link
Owner

sindresorhus commented Sep 3, 2018

Can you add this as a test?

exports.fooError = class extends Error {
    constructor(error) {
        super(error);
        this.name = 'fooError';
    }
};

@sindresorhus
Copy link
Owner

Can you add this as a commented out failing test and open an issue about it?

exports.fooError = class FooError extends Error {
    constructor(error) {
        super(error);
        this.name = 'FooError';
    }
};

@sindresorhus sindresorhus changed the title custom-error-definition - fix null ref custom-error-definition - Fix null refeference Sep 3, 2018
@sindresorhus sindresorhus changed the title custom-error-definition - Fix null refeference custom-error-definition - Fix null reference Sep 3, 2018
@sindresorhus sindresorhus merged commit cf3e22d into sindresorhus:master Sep 3, 2018
@sindresorhus
Copy link
Owner

Thanks :)

@MrHen MrHen deleted the bug/150-custom-error-definition branch September 3, 2018 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

custom-error-definition rule throws
2 participants