title: How to return FluentValidation error code to controller?
body: <p>I have a project that has several layers. Of those layers, I have the Application Layer, where I have my CreateCommand and I also have a Web Layer that contains my controller.</p>
  <p>My CreateCommandValidator in Application Layer looks like this:</p>
  <pre><code>    public CreateCommandValidator()
      {
          RuleFor(c =&gt; c.Firstname)
              .NotEmpty()
              .WithErrorCode(&quot;ERR1234&quot;);
      }
  </code></pre>
  <p>In my StartUp.cs, I have added the below:</p>
  <pre><code>services.AddControllers()
  .AddFluentValidation(fluentValidation =&gt; 
  fluentValidation
  .RegisterValidatorsFromAssembly(AppDomain.CurrentDomain.Load(&quot;MyCustomers.Application&quot;)));
  </code></pre>
  <p>When testing through Postman, I do get the error - FirstName should not be empty.</p>
  <p>But It does not return the error code ERR1234. I would also want it to send this error code to the controller as a bad request. Is this feasible and any hints on how to do it please?</p>