Merging error function with my change to show message when empty.