Skip to content

Commit f881b73

Browse files
committed
Don't re-define any previously defined codes
1 parent 78de59b commit f881b73

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tool/generate-error-constants.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ for (var i = 0; i < codes.length; i++) {
6262

6363
console.log('Wrote constants to ' + targetFile);
6464

65-
function keepOldDefinitionIfMarkedObsolete(codes, num, code) {
66-
if (!codes[num] || !code.startsWith('OBSOLETE_')) {
65+
function addIfNotDefined(codes, num, code) {
66+
if (!codes[num]) {
6767
codes[num] = code;
6868
}
6969
}
@@ -90,7 +90,7 @@ function appendGlobalErrorCodes(srcDir, codes) {
9090
break;
9191
}
9292

93-
keepOldDefinitionIfMarkedObsolete(codes, num, code);
93+
addIfNotDefined(codes, num, code);
9494
}
9595

9696
return codes;
@@ -118,7 +118,7 @@ function appendDatabseErrorCodes(srcDir, codes) {
118118
break;
119119
}
120120

121-
keepOldDefinitionIfMarkedObsolete(codes, num, code);
121+
addIfNotDefined(codes, num, code);
122122
}
123123

124124
return codes;
@@ -133,7 +133,7 @@ function appendSqlErrorCodes(srcDir, codes, errorFile) {
133133
var names = sections[i + 1].match(/^([A-Z0-9_]+)/mg).map(fixupCode);
134134

135135
for (var j = 0; j < names.length; j++) {
136-
keepOldDefinitionIfMarkedObsolete(codes, offset + j, names[j]);
136+
addIfNotDefined(codes, offset + j, names[j]);
137137
}
138138
}
139139

0 commit comments

Comments
 (0)