Skip to content

Commit 946b89b

Browse files
committed
fixup thread repairError from passStyleOf to avoid shadowing
1 parent 5c09e02 commit 946b89b

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

packages/pass-style/src/error.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ const makeTypeError = () => {
8282
}
8383
};
8484

85-
const makeRepairError = () => {
85+
export const makeRepairError = () => {
8686
if (!hardenIsFake()) {
8787
return undefined;
8888
}
@@ -240,13 +240,15 @@ hideAndHardenFunction(isErrorLike);
240240
* @param {string} propName
241241
* @param {PropertyDescriptor} desc
242242
* @param {(val: any) => PassStyle} passStyleOfRecur
243+
* @param {((error: unknown) => void) | undefined} repairError
243244
* @param {Rejector} reject
244245
* @returns {boolean}
245246
*/
246247
export const confirmRecursivelyPassableErrorPropertyDesc = (
247248
propName,
248249
desc,
249250
passStyleOfRecur,
251+
repairError,
250252
reject,
251253
) => {
252254
if (desc.enumerable) {
@@ -363,6 +365,7 @@ export const confirmRecursivelyPassableError = (
363365
propName,
364366
desc,
365367
passStyleOfRecur,
368+
repairError,
366369
reject,
367370
),
368371
);
@@ -390,8 +393,6 @@ export const makeErrorHelper = () => {
390393
});
391394
};
392395

393-
export const repairError = makeRepairError();
394-
395396
/**
396397
* @type {PassStyleHelper}
397398
*/

packages/pass-style/src/passStyleOf.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
getErrorConstructor,
2424
isErrorLike,
2525
makeErrorHelper,
26-
repairError,
26+
makeRepairError,
2727
} from './error.js';
2828
import { RemotableHelper } from './remotable.js';
2929

@@ -39,6 +39,8 @@ import { assertPassableString } from './string.js';
3939
const { ownKeys } = Reflect;
4040
const { isFrozen, getOwnPropertyDescriptors, values } = Object;
4141

42+
const repairError = makeRepairError();
43+
4244
/**
4345
* @template {Record<PassStyle, PassStyleHelper>} HelpersRecord
4446
* @param {PassStyleHelper[]} passStyleHelpers
@@ -284,7 +286,7 @@ hideAndHardenFunction(isPassable);
284286
* @returns {boolean}
285287
*/
286288
const isPassableErrorPropertyDesc = (name, desc) =>
287-
confirmRecursivelyPassableErrorPropertyDesc(name, desc, passStyleOf, false);
289+
confirmRecursivelyPassableErrorPropertyDesc(name, desc, passStyleOf, repairError, false);
288290

289291
/**
290292
* After hardening, if `err` is a passable error, return it.

0 commit comments

Comments
 (0)