Skip to content
This repository has been archived by the owner on Jun 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #425 from malachyoc/fix/424-exception-error-code
Browse files Browse the repository at this point in the history
#424: Set ErrorCode
  • Loading branch information
jordimontana82 authored Jan 28, 2020
2 parents 7a04fb5 + 202731f commit c47178d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public OrganizationResponse Execute(OrganizationRequest req, XrmFakedContext con
else
{
// Entity not found in the context => FaultException
throw new FaultException<OrganizationServiceFault>(new OrganizationServiceFault(), $"{entityName} With Id = {id:D} Does Not Exist");
throw new FaultException<OrganizationServiceFault>(new OrganizationServiceFault() { ErrorCode = unchecked((int)0x80040217) }, $"{entityName} With Id = {id:D} Does Not Exist");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ public void When_retrieve_is_invoked_with_non_existing_entity_null_is_returned()

var service = context.GetOrganizationService();

Assert.Throws<FaultException<OrganizationServiceFault>>(() => service.Retrieve("account", Guid.NewGuid(), new ColumnSet()));
var ex = Assert.Throws<FaultException<OrganizationServiceFault>>(() => service.Retrieve("account", Guid.NewGuid(), new ColumnSet()));
Assert.Equal<uint>((uint)0x80040217, (uint)ex.Detail.ErrorCode);
}

[Fact]
Expand Down

0 comments on commit c47178d

Please sign in to comment.