您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
47 行
1.3 KiB
47 行
1.3 KiB
using System;
|
|
|
|
namespace Unity.Services.Authentication.Editor
|
|
{
|
|
static class AuthenticationSettingsHelper
|
|
{
|
|
internal static Exception ExtractException(Exception exception)
|
|
{
|
|
var aggregatedException = exception as AggregateException;
|
|
if (aggregatedException == null)
|
|
{
|
|
return exception;
|
|
}
|
|
|
|
if (aggregatedException.InnerExceptions.Count > 1)
|
|
{
|
|
// There are multiple exceptions aggregated, don't try to extract exception.
|
|
return exception;
|
|
}
|
|
|
|
// It returns the first exception.
|
|
return aggregatedException.InnerException;
|
|
}
|
|
|
|
internal static string ExceptionToString(Exception exception)
|
|
{
|
|
var errorMessage = "[ERROR] ";
|
|
var currentError = exception;
|
|
var firstError = true;
|
|
while (currentError != null)
|
|
{
|
|
if (!firstError)
|
|
{
|
|
errorMessage += "\n---> ";
|
|
}
|
|
else
|
|
{
|
|
firstError = false;
|
|
}
|
|
errorMessage += currentError.Message;
|
|
currentError = currentError.InnerException;
|
|
}
|
|
|
|
return errorMessage;
|
|
}
|
|
}
|
|
}
|