Skip to content

Commit

Permalink
fix(ObjectExpression): include reference to input pattern in errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards1211 committed Aug 17, 2022
1 parent 652b6d2 commit 860a08e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/jscodeshift/compileMatcher/ObjectExpression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import compileMatcher, {
} from './index'

import { getArrayCaptureAs } from './Capture'
import CompilePathError from '../util/CompilePathError'

function getSimpleKey(
property:
Expand Down Expand Up @@ -93,8 +94,9 @@ export default function compileObjectExpressionMatcher(

if (_captureRestVariable) {
if (captureRestVariable)
throw new Error(
`two capture rest variables aren't allowed, found ${_captureRestVariable} and ${captureRestVariable}`
throw new CompilePathError(
`two capture rest variables aren't allowed, found ${_captureRestVariable} and ${captureRestVariable}`,
path.get('properties').get(i)
)

captureRestVariable = _captureRestVariable
Expand Down

0 comments on commit 860a08e

Please sign in to comment.