Re: Exceptions



Simon Wright <simon.j.wright@xxxxxxx> writes:

I think this would be a very bad idea. I don't want to be forced to
deal with the exception 'here' when it would be better handled by my
caller.

But this would only apply to some exceptions. If you don't want to be
"forced", use an unchecked exception.

I think there are some mistakes in the Java design for exceptions, but I
don't think the whole idea of exception contracts is bad.

- Bob
.



Relevant Pages

  • Re: Some questions about handling exceptions and when to throw them
    ... In the event that a customer can't be ... Possibly even my own exception, ... because the caller should have checked first. ... If GetEmployeeInfo fails, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Some questions about handling exceptions and when to throw them
    ... So in those cases throwing an exception would be a good decision. ... because the caller should have checked first. ... PrinterInfo GetEmployeeDefaultPrinter ... If GetEmployeeInfo fails, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Exception as the primary error handling mechanism?
    ... By throwing an exception, I not only force the caller to handle the ... exception with a catch-handler (as opposed to leaving the choice to the ... catch-handler and failure to do so terminates the program. ...
    (comp.lang.python)
  • Re: Exception handling help please
    ... > void MyFunc() ... > Then in the caller: ... Second, if you throw an object of a class derived from MyException, ... The copy of the exception object specified in the throw expression ...
    (comp.lang.cpp)
  • Re: Omitting return in non-void function
    ... value of the function call is used by the caller, ... In other other words, NO, as specified by the Standard portion he ... function is equivalent to executing a return statement without an ... The sign draws your attention to the exception. ...
    (comp.lang.c)