refactored error outputing

refactored the error outputing in user_edit and post_add views