Better error message when trying to replace CallExpressions instead of ExpressionStatement or VariableDeclarator
I hit a vague "Could not replace path" error today: http://astexplorer.net/#/gist/cfb2f93a39c4a80a1ecf44930092b59f/edca9a554a9aad19c62f098b07ee024a9c418241
After digging around for a while, I found #157, where @fkling wrote:
You should not be looking for CallExpressions but for ExpressionStatements that contain a CallExpression that matches your constraints.
This was exactly my issue! Changing the script to instead look for the ExpressionStatement worked fine: http://astexplorer.net/#/gist/cfb2f93a39c4a80a1ecf44930092b59f/7b4a6f22da67d31cb18e768e0da975f26244ea1e
Can we make the "Could not replace path" error better?
In my case I actually needed to replace a VariableDeclarator not an ExpressionStatement, but it's mostly the same.
what is the best place to improve this error message?