Dear Himanshu
                 While you reply ...use reply all ...as it is in my to list
.Try it out and lemme know.Also we can discuss separately
..U can mail me if you have problems.

[Agarwal Gokul]
> -----Original Message-----
> From: Agarwal Gokul [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, September 28, 2000 2:39 PM
> To:   [EMAIL PROTECTED]
> Subject:      Re: Lets talk about good exception handling!
> Importance:   High
>
> Hi
> I have installed tomcat 3.0 ..Now I am unable to compile my servlets ..How
> do I go about it..Please help me out..Also a hello to all
> from me as this is my first query to the servlet-interest group.
> Regards
> Gokul Kr Agarwal
>
> > -----Original Message-----
> > From: Nic Ferrier [SMTP:[EMAIL PROTECTED]]
> > Sent: Thursday, September 28, 2000 12:24 PM
> > To:   [EMAIL PROTECTED]
> > Subject:      Re: Lets talk about good exception handling!
> >
> > >>> Marc Krisjanous <[EMAIL PROTECTED]> 28-Sep-00 5:24:33 AM
> > >>>
> >
> > >Now, the perfromTask method throws an
> > >ExceptionController(extends Exception)
> > >instance which is caught in the doGet or doPost methods.
> > >Then I currently send the error back to the web browser.
> > > The question is: is this good exception handling??
> >
> > It's perfectly acceptable.
> >
> > Personally I'd do the work that performTask does inside service() and
> > catch all the different exceptions seperately.
> >
> > The thing is that you can't use a formula for exception handling...
> > it's down to what you want to do at the time and in the
> > circumstances:
> >
> > - handle any exception that could be produced in the same way...
> > - handle particular bits of code with special handlers
> > - handle all exceptions specifically
> >
> > This is judgement... if you think hard about what you want to do now
> > it'll come and it'll get easier.
> >
> > Something that can help is looking at good free software (open source
> > code) to see how the pros do it.
> >
> >
> > Here's a few pointers, but even these can't be taken too literally:
> >
> > - always catch Throwable not Exception for generic exceptions
> > Throwable is actually the lowest exception... if you just catch
> > Exception your code will blow up if it gets a Throwable
> >
> > - for small code use a single try/catch with specific exception
> > handlers
> >
> > - for larger code use a try/catch around code that might blow up
> >
> > - use the ServletContext.log method that allows writing stack traces
> > to the log
> >
> > - with servlets think hard about the link between an exception and an
> > HTTP error
> > is it a  500? a 501? a 400? what?
> >
> >
> > Lastly, here's a code fragment that you can use to print stack traces
> > to an html page.
> >
> > The Throwable is called: t.
> > The Writer connected to the response is called: m_out
> >
> >       //we need to do this to collect the stacktrace lines
> >       StringWriter buf=new StringWriter();
> >       PrintWriter stackout=new PrintWriter(buf);
> >       t.printStackTrace(stackout);
> >       //create the tokenizer to get each line of input
> >       StringTokenizer st=new
> > StringTokenizer(buf.getBuffer().toString(),"\n");
> >       while(st.hasMoreTokens())
> >       {
> >         m_out.println(st.nextToken());
> >         m_out.println("<br>");
> >       }
> >       m_out.println("</p>");
> >
> > This can be usefull... eg: I use it when I get something that I class
> > as a 500.
> >
> >
> > Nic
> >
> >
> __________________________________________________________________________
> > _
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> > body
> > of the message "signoff SERVLET-INTEREST".
> >
> > Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > Resources: http://java.sun.com/products/servlet/external-resources.html
> > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
> >
> **************************************************************************
> **
> This electronic communication and any accompanying document is being
> transmitted over the Indian Oil Network and contains confidential
> information that is for the exclusive use of the individual or entity to
> which it is addressed and is protected against unauthorised disclosure. If
> the reader of this message is not the intended receipient or the employee
> or
> agent responsible to deliver to the intended receipient, or is not
> intended
> to act on it, be aware that any disclosure, dissemination, distribution or
> copying of this communication, or the use of its contents is prohibited
> and
> is likely to be attended by legal consequences. If you have received this
> communication in error and/or are not the intended receipient, please
> immediately notify the undersigned or Indian Oil Corporation Ltd. at the
> telephone or the fax number or email address given above and permanently
> delete the original message from your email system.
> **************************************************************************
> **
>
> __________________________________________________________________________
> _
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
****************************************************************************
This electronic communication and any accompanying document is being
transmitted over the Indian Oil Network and contains confidential
information that is for the exclusive use of the individual or entity to
which it is addressed and is protected against unauthorised disclosure. If
the reader of this message is not the intended receipient or the employee or
agent responsible to deliver to the intended receipient, or is not intended
to act on it, be aware that any disclosure, dissemination, distribution or
copying of this communication, or the use of its contents is prohibited and
is likely to be attended by legal consequences. If you have received this
communication in error and/or are not the intended receipient, please
immediately notify the undersigned or Indian Oil Corporation Ltd. at the
telephone or the fax number or email address given above and permanently
delete the original message from your email system.
****************************************************************************

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to