🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.multi-tier
Article #758

Re: Exceptions

#758
From: Michael B
Date: Fri, 24 Nov 2000 00:00
183 lines
5851 bytes
Hi Lev,

since we need a exception handling within client too, I would be very
interested in your solution. I tried to override SafeCallException, but I
couldn't get this running.
I can't figure out, where IAppServer implementation handles internal
exceptions and creates the IErrorInfo needed to support standard
COM-exception handling.

I would appreciate any hint!

Thanks
Michael

Lev Korostyshevsky <lev_ko@hotmail.com> wrote in message
news:8vhg9r$kci5@bornews.inprise.com...
> I needed to throw exceptions not only in the DataSetProvider's events.
>
> Actually I've found the solution, and it's extremely simple. This was a
> matter of implementing correct COM interfaces. A simple alternative is for
> the IAppServer implementation to override TObject::SafeCallException and
> call HandleSafeCallException.
>
> Thanks anyway,
>
> -- Lev
>
> Hans-Rudolf Morelli <morelli.informatik@bluewin.ch> wrote in message
> news:8tm5ns$d521@bornews.borland.com...
> > Hi Lev
> > Not sure if I understand your problem correctly but this might help:
> >
> > If you work with CDSs you would throw the errors within the AppServer in
> the
> > TDataSetProvider::BeforeUpdateRecords or so. There you can throw any
> > exception you want and you can catch it on client within
> > TClientDataSet::OnReconcileError.
> > By
> > Hans
> >
> >
> > "Lev Korostyshevsky" <lev_ko@hotmail.com> schrieb im Newsbeitrag
> > news:8tgtr4$l8v1@bornews.borland.com...
> > > I need to be able to throw an exception in AppServer so in
> TClientDataSet
> > > it's caught in some way. Is it possible ?
> > >
> > > Also, is there a HResult that will make TClientDataSet's call for
> > AppServer
> > > fail, but without showing a message such as "Catastrophic Failure" ?
> > >
> > > --
> > >        Lev Korostyshevsky
> > >        lev@sintecmedia.com
> > >
> > >
> > > Jeroen Eikmans <office@pulse-experts.nl> wrote in message
> > > news:39f9726c$1_2@dnews...
> > > > hello again,
> > > >
> > > > in the else-part you could throw the exception again of course, this
> way
> > > is
> > > > seems that you receive an excpetion from the server:
> > > >
> > > > try {
> > > >   if SUCCEEDED(serverreference->Finalize()) {
> > > >   }
> > > >   else {
> > > >     // some exception has occured on the server --> return value =
> > E_FAIL
> > > >     throw
> > > >
> > >
> >
>
(serverreference->GetExceptionType())(serverreference->GetExceptionMessage()
> > > > );
> > > >   }
> > > > }
> > > > catch (Exception &e) {
> > > >   // normal processsing of the exception
> > > > }
> > > >
> > > > jeroen
> > > >
> > > >
> > > > "Jeroen Eikmans" <office@pulse-experts.nl> wrote in message
> > > > news:39f9712f_2@dnews...
> > > > > hello hans,
> > > > >
> > > > > i have a solution:
> > > > >
> > > > > on my app.server i have:
> > > > >
> > > > > STDMETHODIMP TUNLLogServerImpl::Finalize()
> > > > > {
> > > > >   try {
> > > > >    FDatabase->Connected = false;
> > > > >    return S_OK;
> > > > >   }
> > > > >   catch(...) {
> > > > >    return E_FAIL;
> > > > >   }
> > > > > }
> > > > >
> > > > >
> > > > > On my client i can call this method. I can check if this method is
> > > > processed
> > > > > the right way like this:
> > > > >
> > > > > if SUCCEEDED(serverreference->Finalize()) {
> > > > >
> > > > > }
> > > > > else {
> > > > >   // some exception has occured on the server --> return value =
> > E_FAIL
> > > > > }
> > > > >
> > > > >
> > > > > When you make the exception message accessable on the server in a
> > > > > GetException() method, you can call this from the client in the
> > > else-part
> > > > of
> > > > > the if-statement.
> > > > >
> > > > > By the way a Delphi Client seems to catch a C++Builders App.Server
> > > > > exception, but a C++Builder Client does it not !!
> > > > >
> > > > > I think it has something to do with early vs late binding of the
> > > appserver
> > > > > using a socketconnection.
> > > > >
> > > > > jeroen
> > > > >
> > > > >
> > > > > "Hans-Rudolf Morelli" <morelli.informatik@bluewin.ch> wrote in
> message
> > > > > news:8tbpbg$pp4@bornews.borland.com...
> > > > > > I'd like to catch exceptions from a Midas-AppServer at the
client.
> > The
> > > > > usual
> > > > > > C++-way doesn't seem to work, as I cannot catch the exception of
> > > another
> > > > > app
> > > > > > (the server).
> > > > > >
> > > > > > However Borland has done the job somehow, as within
> OnReconcileError
> > > > > > (client) you can see exceptions being thrown within
> > BeforeUpdateRecord
> > > > > > (server).
> > > > > >
> > > > > > I need a generic way to catch all exceptions of the server
> > (especially
> > > > > > within own added interface functions - not within
TclientDataSet)
> on
> > > the
> > > > > > cllient side.
> > > > > >
> > > > > > Does anyone have a good solution for this????
> > > > > >
> > > > > > Thanks
> > > > > > Hans
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
Technical Details
Message-ID: <3a1e2694$1_2@dnews>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <8tbpbg$pp4@bornews.borland.com> <39f9712f_2@dnews> <39f9726c$1_2@dnews> <8tgtr4$l8v1@bornews.borland.com> <8tm5ns$d521@bornews.borland.com> <8vhg9r$kci5@bornews.inprise.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fcd2b,42053aa43bf4b10
X-Google-Attributes: gidfcd2b,public
From: "Michael B" <michael_baumgaertner@agilent.com>
Subject: Re: Exceptions
Date: 2000/11/24
Message-ID: <3a1e2694$1_2@dnews>
X-Deja-AN: 697329105
References: <8tbpbg$pp4@bornews.borland.com> <39f9712f_2@dnews> <39f9726c$1_2@dnews> <8tgtr4$l8v1@bornews.borland.com> <8tm5ns$d521@bornews.borland.com> <8vhg9r$kci5@bornews.inprise.com>
X-Trace: 24 Nov 2000 00:28:04 -0800, 155.208.254.68
X-MSMail-Priority: Normal
X-Priority: 3
Newsgroups: borland.public.cppbuilder.database.multi-tier
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300