Skip to content

Commit

Permalink
lib: replace use of Error with primordials
Browse files Browse the repository at this point in the history
PR-URL: #31163
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information
Sebastien-Ahkrin authored and Trott committed Jan 4, 2020
1 parent 256c9a4 commit c9b93e2
Show file tree
Hide file tree
Showing 29 changed files with 34 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/.eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ rules:
message: "Use `const { BigInt } = primordials;` instead of the global."
- name: Boolean
message: "Use `const { Boolean } = primordials;` instead of the global."
- name: Error
message: "Use `const { Error } = primordials;` instead of the global."
- name: JSON
message: "Use `const { JSON } = primordials;` instead of the global."
- name: Math
Expand Down
1 change: 1 addition & 0 deletions lib/_http_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
const {
ArrayIsArray,
Boolean,
Error,
NumberIsFinite,
ObjectAssign,
ObjectKeys,
Expand Down
1 change: 1 addition & 0 deletions lib/_http_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
'use strict';

const {
Error,
ObjectKeys,
ObjectSetPrototypeOf,
Symbol,
Expand Down
1 change: 1 addition & 0 deletions lib/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
'use strict';

const {
Error,
ObjectAssign,
ObjectIs,
ObjectKeys,
Expand Down
1 change: 1 addition & 0 deletions lib/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
const {
Array,
ArrayIsArray,
Error,
MathFloor,
MathMin,
MathTrunc,
Expand Down
1 change: 1 addition & 0 deletions lib/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

const {
ArrayIsArray,
Error,
NumberIsInteger,
ObjectAssign,
ObjectDefineProperty,
Expand Down
1 change: 1 addition & 0 deletions lib/domain.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

const {
Array,
Error,
ObjectDefineProperty,
ReflectApply,
Symbol,
Expand Down
1 change: 1 addition & 0 deletions lib/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
const {
Array,
Boolean,
Error,
MathMin,
NumberIsNaN,
ObjectCreate,
Expand Down
1 change: 1 addition & 0 deletions lib/internal/assert/assertion_error.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

const {
Error,
MathMax,
ObjectCreate,
ObjectDefineProperty,
Expand Down
1 change: 1 addition & 0 deletions lib/internal/async_hooks.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

const {
Error,
FunctionPrototypeBind,
NumberIsSafeInteger,
ObjectDefineProperty,
Expand Down
1 change: 1 addition & 0 deletions lib/internal/bootstrap/loaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
/* global process, getLinkedBinding, getInternalBinding, primordials */

const {
Error,
ReflectGet,
ObjectCreate,
ObjectDefineProperty,
Expand Down
1 change: 1 addition & 0 deletions lib/internal/console/constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const {
ArrayFrom,
ArrayIsArray,
Boolean,
Error,
MathFloor,
Number,
ObjectDefineProperties,
Expand Down
1 change: 1 addition & 0 deletions lib/internal/error-serdes.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const Buffer = require('buffer').Buffer;
const {
ArrayPrototypeForEach,
Error,
FunctionPrototypeCall,
ObjectAssign,
ObjectCreate,
Expand Down
1 change: 1 addition & 0 deletions lib/internal/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

const {
ArrayIsArray,
Error,
MathAbs,
NumberIsInteger,
ObjectDefineProperty,
Expand Down
1 change: 1 addition & 0 deletions lib/internal/fs/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const {
ArrayIsArray,
BigInt,
DateNow,
Error,
Number,
NumberIsFinite,
ObjectSetPrototypeOf,
Expand Down
1 change: 1 addition & 0 deletions lib/internal/http2/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const {
ArrayIsArray,
Error,
MathMax,
Number,
ObjectCreate,
Expand Down
1 change: 1 addition & 0 deletions lib/internal/modules/cjs/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

const {
ArrayIsArray,
Error,
JSONParse,
ObjectCreate,
ObjectDefineProperty,
Expand Down
1 change: 1 addition & 0 deletions lib/internal/per_context/domexception.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

const {
Error,
ObjectDefineProperties,
ObjectDefineProperty,
SafeWeakMap,
Expand Down
1 change: 1 addition & 0 deletions lib/internal/process/promises.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

const {
Error,
ObjectDefineProperty,
WeakMap,
} = primordials;
Expand Down
1 change: 1 addition & 0 deletions lib/internal/process/warning.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const {
ArrayIsArray,
Error,
} = primordials;

const { ERR_INVALID_ARG_TYPE } = require('internal/errors').codes;
Expand Down
4 changes: 4 additions & 0 deletions lib/internal/source_map/prepare_stack_trace.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
'use strict';

const {
Error,
} = primordials;

const debug = require('internal/util/debuglog').debuglog('source_map');
const { findSourceMap } = require('internal/source_map/source_map_cache');
const {
Expand Down
1 change: 1 addition & 0 deletions lib/internal/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const {
ArrayFrom,
ArrayIsArray,
Error,
ObjectCreate,
ObjectDefineProperties,
ObjectDefineProperty,
Expand Down
1 change: 1 addition & 0 deletions lib/internal/util/comparisons.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const {
BigIntPrototypeValueOf,
BooleanPrototypeValueOf,
DatePrototypeGetTime,
Error,
NumberIsNaN,
NumberPrototypeValueOf,
ObjectGetOwnPropertySymbols,
Expand Down
2 changes: 2 additions & 0 deletions lib/internal/v8_prof_polyfill.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

/* eslint-disable no-restricted-globals */

module.exports = { versionCheck };

// Don't execute when required directly instead of being eval'd from
Expand Down
1 change: 1 addition & 0 deletions lib/net.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
const {
ArrayIsArray,
Boolean,
Error,
Number,
NumberIsNaN,
ObjectDefineProperty,
Expand Down
1 change: 1 addition & 0 deletions lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
'use strict';

const {
Error,
MathMax,
NumberIsNaN,
ObjectAssign,
Expand Down
1 change: 1 addition & 0 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

const {
ArrayIsArray,
Error,
NumberIsSafeInteger,
ObjectDefineProperties,
ObjectDefineProperty,
Expand Down
1 change: 1 addition & 0 deletions lib/v8.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
const {
Array,
ArrayBuffer,
Error,
Float32Array,
Float64Array,
Int16Array,
Expand Down
1 change: 1 addition & 0 deletions lib/zlib.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
'use strict';

const {
Error,
MathMax,
NumberIsFinite,
NumberIsNaN,
Expand Down

0 comments on commit c9b93e2

Please sign in to comment.