vsts: improve tracing
Adopt the dedicated trace method for handling exceptions.
This commit is contained in:
Родитель
2da9058480
Коммит
393ade4a5c
|
@ -235,7 +235,8 @@ namespace Microsoft.Alm.Authentication
|
|||
}
|
||||
catch (HttpRequestException exception)
|
||||
{
|
||||
context.Trace.WriteLine($"unable to get response from '{targetUri}' due to '{exception.Message}'.");
|
||||
context.Trace.WriteLine($"unable to get response from '{targetUri}', an error occurred before the server could respond.");
|
||||
context.Trace.WriteException(exception);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -427,7 +428,8 @@ namespace Microsoft.Alm.Authentication
|
|||
{
|
||||
System.Diagnostics.Debug.WriteLine(exception);
|
||||
|
||||
Trace.WriteLine($"failed to write credentials to the secure store: {exception.GetType().Name}.");
|
||||
Trace.WriteLine($"failed to write credentials to the secure store.");
|
||||
Trace.WriteException(exception);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -473,7 +475,8 @@ namespace Microsoft.Alm.Authentication
|
|||
{
|
||||
System.Diagnostics.Debug.WriteLine(exception);
|
||||
|
||||
context.Trace.WriteLine($"failed to deserialize tenant cache: {exception.GetType().Name}.");
|
||||
context.Trace.WriteLine($"failed to deserialize tenant cache.");
|
||||
context.Trace.WriteException(exception);
|
||||
|
||||
return cache;
|
||||
}
|
||||
|
@ -579,7 +582,8 @@ namespace Microsoft.Alm.Authentication
|
|||
{
|
||||
System.Diagnostics.Debug.WriteLine(exception);
|
||||
|
||||
context.Trace.WriteLine($"failed to serialize tenant cache: {exception.GetType().Name}.");
|
||||
context.Trace.WriteLine($"failed to serialize tenant cache.");
|
||||
context.Trace.WriteException(exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -222,7 +222,7 @@ namespace Microsoft.Alm.Authentication
|
|||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
context.Trace.WriteLine($"! {exception.Message}");
|
||||
context.Trace.WriteException(exception);
|
||||
}
|
||||
|
||||
yield return result;
|
||||
|
|
|
@ -191,7 +191,7 @@ namespace Microsoft.Alm.Authentication
|
|||
/// <para/>
|
||||
/// Compact tokens are necessary for clients which have restrictions on the size of the basic authentication header which they can create (example: Git).
|
||||
/// </param>
|
||||
[Obsolete("Please use Task<Credential> NoninteractiveLogon(TargetUri targetUri, PersonalAccessTokenOptions options) instead.", false)]
|
||||
[Obsolete("Use Task<Credential> NoninteractiveLogon(TargetUri targetUri, PersonalAccessTokenOptions options) instead.", false)]
|
||||
public async Task<Credential> NoninteractiveLogon(TargetUri targetUri, bool requestCompactToken)
|
||||
{
|
||||
BaseSecureStore.ValidateTargetUri(targetUri);
|
||||
|
|
|
@ -92,7 +92,8 @@ namespace Microsoft.Alm.Authentication
|
|||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
_context.Trace.WriteLine($"error: {nameof(VstsAdalTokenCache)} \"{_cacheFilePath}\": {exception.Message}");
|
||||
_context.Trace.WriteLine($"error: {nameof(VstsAdalTokenCache)} \"{_cacheFilePath}\".");
|
||||
_context.Trace.WriteException(exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +115,8 @@ namespace Microsoft.Alm.Authentication
|
|||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
_context.Trace.WriteLine($"error: {nameof(VstsAdalTokenCache)} \"{_cacheFilePath}\": {exception.Message}");
|
||||
_context.Trace.WriteLine($"error: {nameof(VstsAdalTokenCache)} \"{_cacheFilePath}\".");
|
||||
_context.Trace.WriteException(exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче