Search code examples
asp.net-mvcdci

Error handling in DCI context?


If I'm using ASP.NET MVC framework, instantiating a Context and something goes wrong in there, is it ok to throw an Exception and let the Controller handle it?

And then for nested contexts, can the outer context catch exceptions thrown by the inner one? I'm thinking because contexts cannot be aware of each other, but on the other hand, an error is an error... Right?


Solution

  • A nested context is a context playing a role in another context. The outer context certainly knows of the roles in said context (The context is the only object with knowledge of the roles) an exception from an inner context is in this respect no different than an exception from any other RolePlayer