How can I simplify the following code:
try
{
var metadata = GetMetadata();
return metadata ?? _provider.GetLatestMetadata(guid);
}
catch (AuthenticationException)
{
return _provider.GetLatestMetadata(guid);
}
catch (HttpUnauthorizedRequestException)
{
return _provider.GetLatestMetadata(guid);
}
catch (WebException)
{
return _provider.GetLatestMetadata(guid);
}
catch (VcenterException)
{
return _provider.GetLatestMetadata(guid);
}
I would like to avoid code duplication.
Is it possible?