mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-13 16:10:43 +01:00
fixed error-report within translator.js
reported by [rex-huang](https://community.nodebb.org/user/rex-huang), see https://community.nodebb.org/topic/4520/error-handling-is-wrong-in-translator-js
This commit is contained in:
@@ -283,11 +283,12 @@
|
||||
}
|
||||
|
||||
try {
|
||||
callback(JSON.parse(data.toString()));
|
||||
data = JSON.parse(data.toString());
|
||||
} catch (e) {
|
||||
winston.error('Could not parse `' + filename + '.json`, syntax error? Skipping...');
|
||||
callback({});
|
||||
data = {};
|
||||
}
|
||||
callback(data);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -307,4 +308,4 @@
|
||||
typeof exports === 'object' ? exports :
|
||||
typeof define === 'function' && define.amd ? {} :
|
||||
translator = {}
|
||||
);
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user