errorhandling extended with type specification