Skip to content

Breaking: use VError base signatures. migrate jscs to eslint. - #86

Merged
DonutEspresso merged 4 commits into
masterfrom
verror-base
Feb 21, 2018
Merged

Breaking: use VError base signatures. migrate jscs to eslint. #86
DonutEspresso merged 4 commits into
masterfrom
verror-base

Conversation

@DonutEspresso

Copy link
Copy Markdown
Member

Fixes#76, #77.

This jettisons any custom restify-error constructor APIs in favor of using VError's constructor APIs. This also eliminates the custom .context property in favor of using VError's info construct. A context getter remains on all restify-error base classes to facilitate with migration. More details in README, but this should essentially make restify-errors completely compatible with the VError static methods.

@coveralls

coveralls commented Feb 18, 2018

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.07%) to 98.253% when pulling 94d3d6a on verror-base into ec07e40 on master.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.09%) to 98.268% when pulling 400be1f on verror-base into ec07e40 on master.

@retrohackerretrohacker left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Some quick questions

Comment thread.eslintrc
@@ -1,14 +1,16 @@
{
// eslint: recommended automatically enables most/all rules from the

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The commit message should reflect that the tooling was updated in this PR.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

👍 done, JSCS was freezing/failing for unknown reasons, figured no better time to swap it out.

Comment threadREADME.md

The constructors can be used to new up Error objects with default status codes
set.
This module ships with a set of constructors that can be used to new up Error

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What does "new up" mean?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

new Error, can rephrase if confusing

Comment threadlib/helpers.js
options: options
};
// reconstruct verror ctor options from the cleaned up options
verrorArgs = [ verrorOpts ].concat(_.tail(args));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why is verrorArgs not just verrorOpts? Doesn't adding args back to verrorOpts result in the overlap of the sets being included in the array twice?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

VError has various signatures, the one we care about is new VError({}, 'sprintf', 'sprintf args' ...)

restify-errors options can be appended to the first arg - so what we do here is strip out restify-error specific options from opts, rename the options leftover as verrorOpts, then concat with everything but the first argument of raw args (the first argument being itself).

Comment threadlib/makeConstructor.js Outdated

// code property doesn't have 'Error' in it. remove it.
var defaultCode = name.replace(new RegExp('[Ee]rror$'), '');
var d = _.assign({}, {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I know it's not in the linter but I prefer avoiding one letter variables as it's hard to know what they mean and also hard to search and replace them.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Good call, will rename

@DonutEspressoDonutEspresso changed the title Breaking: use VError base signaturesBreaking: use VError base signatures. migrate jscs to eslint. Feb 21, 2018
@DonutEspresso

Copy link
Copy Markdown
MemberAuthor

Comments addressed, once more?

@DonutEspresso

Copy link
Copy Markdown
MemberAuthor

Thanks all. Excited to get this in, this has been a long time coming.

@DonutEspresso
DonutEspresso merged commit fdbd44c into masterFeb 21, 2018
@DonutEspresso
DonutEspresso deleted the verror-base branch February 21, 2018 22:35
Senseye pushed a commit that referenced this pull request Aug 10, 2026
Stop ignoring package-lock.json and commit it so `npm ci` (used in the
new GitHub Actions workflows) has a lockfile to install from. It was
previously untracked/ignored (since #86), which made
sense before npm ci existed, but now blocks reproducible CI installs.
This has no effect on the published package, since "files": ["lib"]
already excludes the lockfile from the npm tarball.
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for freeto 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.

5 participants

@DonutEspresso@coveralls@retrohacker@hekike@rajatkumar