try and rationalise error handler