🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #7911

Re: Exceptions

#7911
From: Pramod Subramanyan
Date: Sun, 13 May 2001 01:21
61 lines
1877 bytes
try this :
try
{
    // a whole lot of rot
}
catch(Exception e)
{
    System.err.println(e.getMessage());
}
Anyway, I'll warn you that this is not good Java. If you're getting you
exceptions messed up, then use a single try block for the whole method,
this'll allow to catch all the execeptions there easily and make your code
neat.

Use :
void someMethod()
{
    try
    {
        .  . .
        while(someCond)
        {
            . . .
        }
    }
    catch(IOException e)
    {
     }
    catch(DumbException e)
}

rather than
void someMethod()
{
    try
    {
        ...
    }
    catch(..)
    while(someCond)
    {
        try
        {
            ...
        }
        catch(X)
        {
            ...
        }
    }
}

ArShAm <ArShAm@abshar.net> wrote in message news:3afd970d_2@dnews...
>     Hi there
> I want to catch all exceptions in one catch statement , is it possible? if
> it is , how to show the result?
>
> Thanks
>     ArShAm
>
>
Technical Details
Message-ID: <3afde345_2@dnews>
Path: arc1-ca.pugleaf.net!archiver1.sj.google.com!newsfeed.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews
References: <3afd970d_2@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,339b44372789753e
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-05-12 18:40:04 PST
From: "Pramod Subramanyan" <pramod_sx@rediffmail.com>
Newsgroups: borland.public.jbuilder.java.language
References: <3afd970d_2@dnews>
Subject: Re: Exceptions
Date: Sun, 13 May 2001 06:51:48 +0530
Lines: 63
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
NNTP-Posting-Host: 61.1.24.89
Message-ID: <3afde345_2@dnews>
X-Trace: dnews 989717317 61.1.24.89 (12 May 2001 18:28:37 -0700)
Path: arc1-ca.pugleaf.net!archiver1.sj.google.com!newsfeed.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews