1
0
Форкнуть 0
Adopt the dedicated trace method for handling exceptions.
This commit is contained in:
J Wyman ∞ 2018-05-02 12:26:08 -04:00
Родитель 2da9058480
Коммит 393ade4a5c
4 изменённых файлов: 14 добавлений и 8 удалений

Просмотреть файл

@ -235,7 +235,8 @@ namespace Microsoft.Alm.Authentication
} }
catch (HttpRequestException exception) 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 else
@ -427,7 +428,8 @@ namespace Microsoft.Alm.Authentication
{ {
System.Diagnostics.Debug.WriteLine(exception); 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); 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; return cache;
} }
@ -579,7 +582,8 @@ namespace Microsoft.Alm.Authentication
{ {
System.Diagnostics.Debug.WriteLine(exception); 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) catch (Exception exception)
{ {
context.Trace.WriteLine($"! {exception.Message}"); context.Trace.WriteException(exception);
} }
yield return result; yield return result;

Просмотреть файл

@ -191,7 +191,7 @@ namespace Microsoft.Alm.Authentication
/// <para/> /// <para/>
/// Compact tokens are necessary for clients which have restrictions on the size of the basic authentication header which they can create (example: Git). /// Compact tokens are necessary for clients which have restrictions on the size of the basic authentication header which they can create (example: Git).
/// </param> /// </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) public async Task<Credential> NoninteractiveLogon(TargetUri targetUri, bool requestCompactToken)
{ {
BaseSecureStore.ValidateTargetUri(targetUri); BaseSecureStore.ValidateTargetUri(targetUri);

Просмотреть файл

@ -92,7 +92,8 @@ namespace Microsoft.Alm.Authentication
} }
catch (Exception exception) 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) catch (Exception exception)
{ {
_context.Trace.WriteLine($"error: {nameof(VstsAdalTokenCache)} \"{_cacheFilePath}\": {exception.Message}"); _context.Trace.WriteLine($"error: {nameof(VstsAdalTokenCache)} \"{_cacheFilePath}\".");
_context.Trace.WriteException(exception);
} }
} }
} }