1
0
Эх сурвалжийг харах

Don't throw an error when a method has no known errors

YouTwitFace 5 жил өмнө
parent
commit
8502548262

+ 11 - 8
gramjs_generator/parsers/methods.js

@@ -47,15 +47,18 @@ const parseMethods = function*(csvFile, friendlyCsvFile, errorsDict) {
     for (let line = 0; line < f2.length; line++) {
         let [method, usability, errors] = f2[line];
 
-        errors = errors.split(' ').map(x => {
-            if (x && !(x in errorsDict)) {
-                throw new Error(
-                    `Method ${method} references unknown errors ${errors}`
-                );
-            }
+        errors = errors
+            .split(' ')
+            .filter(Boolean)
+            .map(x => {
+                if (x && !(x in errorsDict)) {
+                    throw new Error(
+                        `Method ${method} references unknown errors ${errors}`
+                    );
+                }
 
-            return errorsDict[x];
-        });
+                return errorsDict[x];
+            });
 
         const friendly = rawToFriendly[method];
         delete rawToFriendly[method];