Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polish mangle error messages #548

Merged
merged 1 commit into from May 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 7 additions & 9 deletions packages/babel-plugin-minify-mangle-names/src/index.js
Expand Up @@ -153,10 +153,9 @@ module.exports = babel => {
// This should NOT happen ultimately. Panic if this code block is
// reached
throw new Error(
"Binding not found for ReferencedIdentifier. " +
name +
"Please report this at " +
newIssueUrl
`Binding not found for ReferencedIdentifier "${name}" ` +
`present in "${path.parentPath.type}". ` +
`Please report this at ${newIssueUrl}`
);
} else {
// Add it to our scope tracker if everything is fine
Expand Down Expand Up @@ -188,10 +187,9 @@ module.exports = babel => {

// This should NOT happen ultimately. Panic if this code is reached
throw new Error(
"Binding not found for BindingIdentifier. " +
name +
"Please report this at " +
newIssueUrl
`Binding not found for BindingIdentifier "${name}" ` +
`present in "${path.parentPath.type}". ` +
`Please report this at ${newIssueUrl}`
);
}

Expand Down Expand Up @@ -480,7 +478,7 @@ module.exports = babel => {
} else {
throw new Error(
`Unexpected Rename Error: ` +
`Trying to replace ${node.name}: from ${oldName} to ${newName}` +
`Trying to replace "${node.name}": from "${oldName}" to "${newName}". ` +
`Please report it at ${newIssueUrl}`
);
}
Expand Down
14 changes: 6 additions & 8 deletions packages/babel-plugin-minify-mangle-names/src/scope-tracker.js
Expand Up @@ -42,7 +42,7 @@ module.exports = class ScopeTracker {
this.references.get(parent).add(name);
if (!binding) {
throw new Error(
`Binding Not Found for ${name} during scopeTracker.addRefernce: ` +
`Binding Not Found for ${name} during scopeTracker.addRefernce. ` +
`Please report at ${newIssueUrl}`
);
}
Expand Down Expand Up @@ -83,8 +83,8 @@ module.exports = class ScopeTracker {
if (!binding) {
// Something went wrong - panic
throw new Error(
"Binding Not Found during scopeTracker.updateRefernce: " +
`Updating "${oldName}" to "${newName}"` +
"Binding Not Found during scopeTracker.updateRefernce " +
`while updating "${oldName}" to "${newName}". ` +
`Please report at ${newIssueUrl}`
);
}
Expand Down Expand Up @@ -167,11 +167,9 @@ module.exports = class ScopeTracker {

if (existingBinding && existingBinding !== binding) {
throw new Error(
"Binding " +
existingBinding.identifier.name +
"already exists. " +
"Trying to add " +
binding.identifier.name
`scopeTracker.addBinding: ` +
`Binding "${existingBinding.identifier.name}" already exists. ` +
`Trying to add "${binding.identifier.name}" again.`
);
}

Expand Down