Was:Exception on creating instance of PersistentStorage Class

Hello,

I don’t have answer to this question, but seeing the exception thrown I wonder why the GHI .NetMF does seem to throw only “System.Exception(s)” ?
I got the same exception in my USB Host programs.

Could it be possible to have more precise exceptions ? This would also help program to react differently, depending on the type of the exception. What do you think ?

Maybe an GHIElectronics.NETMF.Exception assembly could be provided ?

Best regards,


Christophe

Exceptions are rare things and shouldn’t cause that much trouble… A more precise exception would be nice, but the process actually is complex and unlikely to change.

Ok :frowning:

But without creating a GHIException assembly, would it be possible to detail a little bit more the exception generated ?
I mean, there are lots of existing System.Exceptions so maybe exceptions like System.ArgumentOutOfRangeException or System.DivideByZeroException (if applicable, of course) could be thrown instead of the generic (and not meaningful) System.Exception with no info on what generated it.

Best regards,


Christophe

Exceptions like out of range, divide by zero, not implemented…etc. are being used whenever possible. I am not sure why you think we only use system exception?

At first, when I was debugging my tests with USB Host, I only got System.Exception(s). I then thought that I was unlucky but I remembered that I also got the same exceptions in my very first programs for the board.
And now I see another guy getting the same exception in another domain. That’s the reason why I think (thought) you were not throwing “dedicated” exceptions.

Also, Supa’s answer did almost confirm my idea.

If I’m wrong, which I hope, then that’s fine and you can forget my request :wink: With apologies from me.

Best regards,


Christophe

When we have error internal to the system (USB or SD…etc.) then the exception is a “system exception” :wink: but when the error is something else then we do raise the appropriate exception.

I think this is just a misunderstanding :slight_smile:

In the case of USB, GetLastError() will get some good info on expection.

Then I was really unlucky with my tests :stuck_out_tongue:

Yes indeed. And it was very useful.

I doin’t know if it was misunderstanding, but the clarification will help anyway. Thank you very much.

ps: and of course you can forget my request :wink:

Try to create an array and exceed it’s length. You will get a proper exception :wink: