mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 11:05:54 +01:00 
			
		
		
		
	better error handling for custom langauge files
This commit is contained in:
		| @@ -262,8 +262,15 @@ var fs = require('fs'), | ||||
|  | ||||
| 							async.each(languages, function(pathToLang, next) { | ||||
| 								fs.readFile(pathToLang, function(err, file) { | ||||
| 									try { | ||||
| 										var json = JSON.parse(file.toString());	 | ||||
| 									} catch (err) { | ||||
| 										winston.error('[plugins] Unable to parse custom language file: ' + pathToLang + '\r\n' + err.stack); | ||||
| 										return next(err); | ||||
| 									} | ||||
|  | ||||
| 									arr.push({ | ||||
| 										file: JSON.parse(file.toString()), | ||||
| 										file: json, | ||||
| 										route: pathToLang.replace(pathToFolder, '') | ||||
| 									}); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user