Returning useful exception when sorting on a completion field

Closes #3747