Device-specific: template_base::check_invalid() now returns an error code instead of throwing an exception