Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup & update ErrorRecord class code style #9021

Merged
merged 4 commits into from Mar 6, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Prev

♻️ Use braced if statements

  • Loading branch information...
vexx32 committed Mar 4, 2019
commit e4d93477bf86e3694e2476584cca18d18801778c
@@ -194,7 +194,10 @@ public class ErrorCategoryInfo
internal ErrorCategoryInfo(ErrorRecord errorRecord)
{
if (errorRecord == null)
{
throw new ArgumentNullException(nameof(errorRecord));
}

_errorRecord = errorRecord;
}
#endregion ctor
@@ -223,7 +226,9 @@ public string Activity
get
{
if (!string.IsNullOrEmpty(_errorRecord._activityOverride))
{
return _errorRecord._activityOverride;
}

if (_errorRecord.InvocationInfo != null
&& (_errorRecord.InvocationInfo.MyCommand is CmdletInfo || _errorRecord.InvocationInfo.MyCommand is IScriptCommandInfo)
@@ -257,7 +262,10 @@ public string Reason
{
_reasonIsExceptionType = false;
if (!string.IsNullOrEmpty(_errorRecord._reasonOverride))
{
return _errorRecord._reasonOverride;
}

if (_errorRecord.Exception != null)
{
_reasonIsExceptionType = true;
@@ -290,7 +298,10 @@ public string TargetName
get
{
if (!string.IsNullOrEmpty(_errorRecord._targetNameOverride))
{
return _errorRecord._targetNameOverride;
}

if (_errorRecord.TargetObject != null)
{
string targetInString;
@@ -330,7 +341,10 @@ public string TargetType
get
{
if (!string.IsNullOrEmpty(_errorRecord._targetTypeOverride))
{
return _errorRecord._targetTypeOverride;
}

if (_errorRecord.TargetObject != null)
{
return _errorRecord.TargetObject.GetType().Name;
@@ -797,13 +811,19 @@ public override string ToString()
params object[] args)
{
if (cmdlet == null)
{
throw PSTraceSource.NewArgumentNullException(nameof(cmdlet));
}

if (string.IsNullOrEmpty(baseName))
{
throw PSTraceSource.NewArgumentNullException(nameof(baseName));
}

if (string.IsNullOrEmpty(resourceId))
{
throw PSTraceSource.NewArgumentNullException(nameof(resourceId));
}

string template = string.Empty;

@@ -832,13 +852,19 @@ public override string ToString()
params object[] args)
{
if (resourceSupplier == null)
{
throw PSTraceSource.NewArgumentNullException(nameof(resourceSupplier));
}

if (string.IsNullOrEmpty(baseName))
{
throw PSTraceSource.NewArgumentNullException(nameof(baseName));
}

if (string.IsNullOrEmpty(resourceId))
{
throw PSTraceSource.NewArgumentNullException(nameof(resourceId));
}

string template = string.Empty;

@@ -867,13 +893,19 @@ public override string ToString()
params object[] args)
{
if (assembly == null)
{
throw PSTraceSource.NewArgumentNullException(nameof(assembly));
}

if (string.IsNullOrEmpty(baseName))
{
throw PSTraceSource.NewArgumentNullException(nameof(baseName));
}

if (string.IsNullOrEmpty(resourceId))
{
throw PSTraceSource.NewArgumentNullException(nameof(resourceId));
}

string template = string.Empty;

@@ -1385,7 +1417,10 @@ private void ConstructFromPSObjectForRemoting(PSObject serializedErrorRecord)
_targetNameOverride = errorRecord._targetNameOverride;
_targetTypeOverride = errorRecord._targetTypeOverride;
if (errorRecord.ErrorDetails != null)
{
ErrorDetails = new ErrorDetails(errorRecord.ErrorDetails);
}

SetInvocationInfo(errorRecord._invocationInfo);
_scriptStackTrace = errorRecord._scriptStackTrace;
_serializedFullyQualifiedErrorId = errorRecord._serializedFullyQualifiedErrorId;
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.