What is the origin of the throw/catch exception naming?
Was the creator of this construct a baseball fan? ...
Was the creator of this construct a baseball fan? ...
How would one display what line number caused the error and is this even possible with the way that .net compiles its exes? If not is there an automated way for exception.message to display the sub that crapped out? try { int x = textbox1.text; } catch(exception ex) { messagebox.show(ex.message); } ...
I have some special exception cases that I want to throw and catch, so I want to define my own exception classes. What are the best practices for that? Should I inherit from std::exception or std::runtime_error? ...
The specific error that I'm getting is a System.ArgumentException with a message of "Value does not fall within the expected range". I'd like to know specifically what could cause this error (I suspect some kind of overflow), but I'd also like to know if there's a place where these sort of generic .NET messages and their causes are list...
This issue is important especially for embedded development. Exception handling adds some footprint to generated binary output. On the other hand, without exceptions the errors need to be handled some other way, which requires additional code, which eventually also increases binary size. I'm interested in your experiences, especially: ...
I want to have a way to report the stack trace to the user if an exception is thrown. What is the best way to do this? Does it take huge amounts of extra code? To answer questions: I'd like it to be portable if possible. I want information to pop up, so the user can copy the stack trace and email it to me if an error comes up. ...
On my XAMPP/Win XP build, PHP5.2.3 fails to catch any exceptions. None of the examples work, and this: try { throw new Exception('Fail'); } catch (Exception $e) { echo 'Succeed'; } ...results in: Fatal error: Uncaught exception 'Exception' with message 'Fail' in M:\path\to\test.php:4 Stack trace: #0 {main} thrown in ...
My Scenario: I'm using a Silverlight MVVM pattern. All my view models inherit from a BaseViewModel class that maintains some basic values and behaviours. One of these behaviours determines if the user is authorised to use particular functionality and returns a boolean. If the function is not located, I want to throw a new exception an...
I want my program to be able to edit a values within a registry key that resides in 'HKEY_LOCAL_MACHINE' My.Computer.Registry.SetValue("HKEY_LOCAL_MACHINE\SOFTWARE\XYZ", "MyValue", "MyData") The above works fine in Windows XP, but throws an UnauthorizedAccessException in Vista. ...
I have access to ruby's exception hierarchy (it's mentioned in both the pickaxe and the hummingbird), but I'm not sure which exception to use because I haven't found any information on what each of the terms mean. Does using the right exception class matter? ...
I'm trying to debug a problem (exception being thrown) in an ASP.NET MVC program using the Microsoft CLR Debugger. It works pretty well, except after a minute or two, the debugger gets detached (the web request times out or something?) and I can no longer inspect its state. This is extremely frustrating. How can I make the server/debu...
I'm using C# with the XNA library and I'm getting NaNs cropping up in my Vector3 objects. Is there a way to break into the debugger when the offending calculation happens (e.g. a divide by zero)? Currently the program just continues running. I'm using VS2008 Professional. All the exceptions in the Exceptions dialog are selected in the...
What kind of answers would you accept to the following question "Describe the process and/or pitfall of throwing exceptions from constructor and destructors" (C++/C#/java) What amount of knowledge about this would you consider essential, for a candidate claiming to have several years of experience in any of these languages (if he misse...
I have a complex application that consists of an Application, containing many modules, each containing many views. The behaviours of my views may throw exceptions. Sometimes I want to handle exceptions on the view that created them, sometimes in the parent module, sometimes in the grand-parent application. The concept of RoutedEvents s...
Hi, I was reading a couple of articles a while back which I think described a behaviour where you can, in a .net application (specifically VB.net), allow an exception to occur, and then handle it in some kind of application-level exception handler, as opposed to within a Try/Catch block. My google-fu is weak at the moment, so I'm not hav...
We have an .NET desktop application that crashed in production. How do we diagnose the error? I'd like to know the type of exception that occurred, the error message, and the stack trace. Because the exception wasn't handled by our code, we received the "This application has encountered a problem and needs to close" Windows message box....
Is it good design to throw exceptions from SQL CLR stored procedures? Since we are in the context of SQL Server, do any special considerations need to be made? Is this bad design? [Microsoft.SqlServer.Server.SqlProcedure] public static void MyStoredProcedure(string foo) { if (string.IsNullOrEmpty(foo)) { throw new Argum...
I have a simple web service to allow applications to query my CMDB. The function I am having trouble with works with a small resultset but fails with a larger one, indicating that it is something in the WCF service config that is preventing it succeeding. I have a simple WinForms test app with a Service Reference to the web service and...
Hi all, Imagine I have the methods: public static void funcA() {...} public static void funcB() { byteBuffer.wrap(someByteArray, 0, someByteArra.length); } IN JAVA API: public static ByteBuffer wrap(byte[]array, int offset, int length) { try { return new HeapByteBuffer(array, offset, length); } catch (IllegalAr...
I'm implementing a event system: Various pieces of code will post events to a central place where they will be distributed to all listeners. The main problem with this approach: When an exception happens during event processing, I can't tell anymore who posted the event. So my question is: Is there an efficient way to figure out who cal...