Article View: borland.public.cppbuilder.database.multi-tier
Article #756Re: Exceptions
From: Lev Korostyshevsky
Date: Wed, 22 Nov 2000 22:11
Date: Wed, 22 Nov 2000 22:11
162 lines
5288 bytes
5288 bytes
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:
<8vhg9r$kci5@bornews.inprise.com>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-xit-03!supernews.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!bornews.borland.com!not-for-mailReferences:
<8tbpbg$pp4@bornews.borland.com> <39f9712f_2@dnews> <39f9726c$1_2@dnews> <8tgtr4$l8v1@bornews.borland.com> <8tm5ns$d521@bornews.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fcd2b,42053aa43bf4b10,start X-Google-Attributes: gidfcd2b,public X-Google-ArrivalTime: 2000-11-22 14:12:37 PST Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!sn-xit-03!supernews.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!bornews.borland.com!not-for-mail From: "Lev Korostyshevsky" <lev_ko@hotmail.com> Newsgroups: borland.public.cppbuilder.database.multi-tier Subject: Re: Exceptions Date: Thu, 23 Nov 2000 00:11:25 +0200 Organization: Another Netscape Collabra Server User Lines: 164 Message-ID: <8vhg9r$kci5@bornews.inprise.com> References: <8tbpbg$pp4@bornews.borland.com> <39f9712f_2@dnews> <39f9726c$1_2@dnews> <8tgtr4$l8v1@bornews.borland.com> <8tm5ns$d521@bornews.borland.com> NNTP-Posting-Host: 212.143.210.23 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300