implemented basic error handler