June 17, 2008
@ 03:05 PM

Compare the following two error messages and think about which you would find more helpful.  Then, the next time you are throwing exceptions with messages remember this post.

Error Message from Castle's Windsor IoC libraries:

Can't create component 'ProductService' as it has dependencies to be satisfied.

ProductService is waiting for the following dependencies:

Services:
- JPCycles.Framework.Services.IInventoryService which was registered but is also waiting for dependencies.

ControllerInventory is waiting for the following dependencies:

Services:
- JPCycles.Controller.IInventoryRequestInterpreter which was not registered.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: Castle.MicroKernel.Handlers.HandlerException: Can't create component 'ProductService' as it has dependencies to be satisfied.

ProductService is waiting for the following dependencies:

Services:
- JPCycles.Framework.Services.IInventoryService which was registered but is also waiting for dependencies.

ControllerInventory is waiting for the following dependencies:

Services:
- JPCycles.Controller.IInventoryRequestInterpreter which was not registered.

Error Message from .NET framework:

Object reference not set to an instance of an object.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

 
Tuesday, June 17, 2008 11:11:27 PM (Central Standard Time, UTC-06:00)
Awesome! I have long hated the Object Null Reference Error. It is horrible! Sometimes I actually cheat a little when setting up Windsor Configs by letting it's fantastic error messages guide me towards having my components set up.
Tuesday, August 19, 2008 11:40:01 AM (Central Standard Time, UTC-06:00)
Here's a great example I just ran across, just thought I'd share:



TestCase 'JPCycles.MVC.WebTests.HttpModules.HttpSecureTests.Verify_that_the_HttpSecure_blocks_listed_IPAddress'
failed: TypeMock.TypeMockException :
*** Typemock Isolator is not currently enabled.
To enable do one of the following:

* To run Typemock Isolator as part of an automated process you can:
- run tests via TMockRunner.exe command line tool
- use 'TypeMockStart' tasks for MSBuild or NAnt

* To work with Typemock Isolator inside Visual Studio.NET:
set Tools->Enable Typemock Isolator from within Visual Studio

For more information consult the documentation (see 'Running' topic)
at TypeMock.MockManager.Init(Boolean collectAllCalls)
at TypeMock.MockManager.e(Type A_0)
at TypeMock.MockManager.Mock(Type type, Constructor mockConstructors)
at TypeMock.MockManager.MockObject(Type type, Constructor mockConstructors, Object[] args)
at TypeMock.MockManager.MockObject[TMockedType]()
C:\Web\src\JPCycles.MVC.WebTests\HttpModules\HttpSecureTests.cs(19,0): at JPCycles.MVC.WebTests.HttpModules.HttpSecureTests.Verify_that_the_HttpSecure_blocks_listed_IPAddress()


0 passed, 1 failed, 0 skipped, took 2.05 seconds.
Name
E-mail
(will show your gravatar icon)
Home page

Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, i, strike, strong, sub, super, u) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview