コード例 #1
0
        private static PSObject EncodeException(Exception exception)
        {
            ErrorRecord errorRecord   = exception is IContainsErrorRecord containsErrorRecord ? new ErrorRecord(containsErrorRecord.ErrorRecord, exception) : new ErrorRecord(exception, "RemoteHostExecutionException", ErrorCategory.NotSpecified, (object)null);
            PSObject    emptyPsObject = RemotingEncoder.CreateEmptyPSObject();

            errorRecord.ToPSObjectForRemoting(emptyPsObject);
            return(emptyPsObject);
        }