-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
Description
Given this code:
// err.js
goog.module('example.Err');
class Err extends Error {}
exports = Err;
// thrower.js
goog.module('example.thrower');
const Err = goog.require('example.Err');
function throwErr() {
throw new Err('please replace me');
}
String replacement does not occur when compiling with --replace_strings='example.Err(?)'
.
It does occur when compiling with --replace_strings='Err(?)'
.
Just using the short name is not a great solution, since short names can conflict, and module names can be shortened differently, across different modules in the compilation unit.
The same issue exists with goog.scope
, but then at least you can simply avoid scoping the error type. With goog.module
, the namespace must be removed, so there is no way to specify that a string replacement should be applied to a certain error type.