How to create a DataPortalException object with HttpErrorInfo #2367
Unanswered
oleksandr-yevchenko
asked this question in
Questions
Replies: 1 comment
-
You can safely use |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am writing unit tests for handling exceptions in my solution using CSLA 5.4.1. And I need to replicate the behaviour of the app when it is handling DataPortalException.
So, I would like to create a DataPortalException using the constructor:
When I create it this way:
var ex = new DataPortalException(new HttpErrorInfo());
I am getting the error hint on
new HttpErrorInfo()
:CSLA0011: CSLA business objects should not be created outside of a ObjectFactory instance.
Some research:
1.
var errorInfo = DataPortal.Create<HttpErrorInfo>(new ValidationException("The object is not valid"));
throws Csla.DataPortalException: 'DataPortal.Create failed (Invalid operation - create not allowed)'
Thanks and cheers,
Oleksandr
Beta Was this translation helpful? Give feedback.
All reactions