mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-23 22:11:09 +03:00
Show parse error message during a failed import
adds support for outputting error message during a failed JSON.parse This will help people identify the problem with their JSON source and hopefully be able to aid them in resolving said issue.
This commit is contained in:
parent
f273e17e08
commit
d9e7a05fbc
@ -8,8 +8,8 @@ var dataExport = require('../data/export'),
|
||||
_ = require('lodash'),
|
||||
schema = require('../data/schema').tables,
|
||||
config = require('../config'),
|
||||
errors = require('../../server/errorHandling'),
|
||||
api = {},
|
||||
|
||||
db;
|
||||
|
||||
api.notifications = require('./notifications');
|
||||
@ -76,7 +76,8 @@ db = {
|
||||
try {
|
||||
importData = JSON.parse(fileContents);
|
||||
} catch (e) {
|
||||
return when.reject(new Error("Failed to parse the import file"));
|
||||
errors.logError(e, "API DB import content", "check that the import file is valid JSON.");
|
||||
return when.reject(new Error("Failed to parse the import JSON file"));
|
||||
}
|
||||
|
||||
if (!importData.meta || !importData.meta.version) {
|
||||
|
Loading…
Reference in New Issue
Block a user