Method LogException
LogException(AsyncOperationHandle, Exception)
Write an exception as a log message.
선언
public static void LogException(AsyncOperationHandle op, Exception ex)
파라미터
타입 | 이름 | 설명 |
---|---|---|
AsyncOperationHandle | op | The operation handle. |
Exception | ex | The exception. |
참고
LogException can be used to convert an exception to a log message. The exception is stringified. If the operation is in a failed state, the exception is logged at an Error logging level. If not the exception is logged at a Debug logging level. Addressables logs warnings and errors so if the operation is not in a failed state by default this function will not log.
예
public async Task<Material> LogExceptionSuccessfulTask(bool isErrored)
{
var loadHandle = Addressables.LoadAssetAsync<Material>("green.material");
var material = await loadHandle.Task;
if (loadHandle.Status == AsyncOperationStatus.Failed)
{
// something went wrong, log it and return the placeholder material
Addressables.LogException(loadHandle, loadHandle.OperationException);
return k_PlaceholderMaterial;
}
return material;
}
참고
LogException(Exception)
Write an exception as a debug log message.
선언
public static void LogException(Exception ex)
파라미터
타입 | 이름 | 설명 |
---|---|---|
Exception | ex | The exception. |
참고
LogException can be used to convert an exception to a log message. The exception is stringified and logged at a Debug logging level. Addressables logs warnings and errors so by default this function will not log.
예
public void LogExceptionDebugLogging(bool isErrored)
{
try
{
if (isErrored)
{
throw new Exception("Unable to complete task");
}
} catch(Exception e)
{
Addressables.LogException(e);
}
}