Correct format_errors for nested dictionaries

In the case of errors on EmbeddedDocuments, the format_errors() function had
an exception due to the error being returned as a dictionary, instead of a
string.