improve formatting of error objects