﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
19820	Make loaddata error messages less cryptic	bigfudge	nobody	"At present, error messages when running loaddata don't include any clue about the part of the serialised data which caused the problem.

In the Deserialiser function (in core.serializers.json.py) there is a try/except block on line 40 to 47 which could be amended to aid the user:


{{{
def Deserializer(stream_or_string, **options):
    """"""
    Deserialize a stream or string of JSON data.
    """"""
    if isinstance(stream_or_string, basestring):
        stream = StringIO(stream_or_string)
    else:
        stream = stream_or_string
    try:
        for obj in PythonDeserializer(simplejson.load(stream), **options):
            yield obj
    except GeneratorExit:
        raise
    except Exception, e:
        # Map to deserializer error
        raise DeserializationError(e)

}}}


If raise DeserializationError(e) were changed to raise DeserializationError(e, obj) then the function would return a tuple containing the current error message (which isn't that informative) and the object which causes the error.

This has been a big issue for me recently in migrating a pilot installation which used sqlite over to postgres. There were a number of data integrity issues which using postgres highlighted, but it was only by applying this change that it became possible to identify the records which were causing the problem.

"	Cleanup/optimization	closed	Core (Serialization)	dev	Normal	fixed		reames@…	Accepted	1	0	0	0	0	0
