handle an error condition in the front end js