# GrapeCity.Enterprise.Data.Expressions.Evaluation.Variant.CreateError

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_Enterprise_Data_Expressions_Evaluation_Variant_CreateError_" data-uid="GrapeCity.Enterprise.Data.Expressions.Evaluation.Variant.CreateError*">CreateError Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_Enterprise_Data_Expressions_Evaluation_Variant_CreateError_" data-uid="GrapeCity.Enterprise.Data.Expressions.Evaluation.Variant.CreateError*"></a>
<h4 id="GrapeCity_Enterprise_Data_Expressions_Evaluation_Variant_CreateError_System_String_GrapeCity_Enterprise_Data_Expressions_Evaluation_ErrorCode_System_String_" data-uid="GrapeCity.Enterprise.Data.Expressions.Evaluation.Variant.CreateError(System.String,GrapeCity.Enterprise.Data.Expressions.Evaluation.ErrorCode,System.String)">CreateError(string, ErrorCode, string)</h4>
<div class="markdown level1 summary"><p>Creates a new Error Variant with the specified message and error code.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static Variant CreateError(string message, ErrorCode errorCode = ErrorCode.InvalidOperation, string methodName = null)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">message</span></td>
      <td><p>The error message.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.Enterprise.Data.Expressions.Evaluation.ErrorCode.html">ErrorCode</a></td>
      <td><span class="parametername">errorCode</span></td>
      <td><p>The error code.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">methodName</span></td>
      <td><p>The name of the method where the error occurred. This parameter is optional.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="GrapeCity.Enterprise.Data.Expressions.Evaluation.Variant.html">Variant</a></td>
      <td><p>A new Error Variant.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
