dblock / vmwaretasks

C# VixCOM Wrapper Library & Tools
MIT License
59 stars 52 forks source link

#7: VMWareTasks.proj's vixcom target needs to be updated to use Visual Studio 2005's tlbimp.exe #8

Closed icnocop closed 11 years ago

icnocop commented 11 years ago

7: VMWareTasks.proj's vixcom target needs to be updated to use Visual Studio 2005's tlbimp.exe

dblock commented 11 years ago

I am generally against mapping any single error thrown by VMWare to a specific exception. That will grow to some huge number of errors, no? The next thing people will be asking why aren't all of them wrapped ;)

icnocop commented 11 years ago

I think this library would be better if it has more specific exceptions because it would allow for callers to catch and handle specific exceptions that they are only really interested in instead of a generic exception that could have many meanings.

We can derive all the specific exceptions from VMWareException so that the changes are backward compatible for example. We can also tailor the specific error messages like this:

public VMWareFileNotFoundException(string fileName) : base(string.Format("The file cannot be found: {0}", fileName)) {}

instead of wrapping the underlying string from the VIX API.

Yes, the number of exceptions can potentially grow to be the same number of error codes in the VIX API, which is around 263 (v1.12). However, we certainly don't have to implement all of them (especially right away), but only if\when they are requested\needed, and only those that may be thrown from the VIX API methods that the library calls.

Here is a related work item: http://vmwaretasks.codeplex.com/workitem/1627

dblock commented 11 years ago

I would be happy to take a commit that derives specific exceptions from VMWareException. You might want to split the tlbimp stuff from this too just to clear the plate a bit.

icnocop commented 11 years ago

Sorry, I'm not sure how to tell git to ignore the changes in VMWareException.cs in this pull request. Any advice? It seems it's mainly because I had moved it to another folder, and now I am trying to move it back, but it was never moved in the original repository. Thank you.

dblock commented 11 years ago

It's weird. Want to open a new clean PR from a new branch so that we don't have all that exception stuff in it?

icnocop commented 11 years ago

Closing pull request in lieu of new pull request https://github.com/dblock/vmwaretasks/pull/10