implemented alert function for error alerts