#1 2020-02-04 13:28:47

VojkoCendak
Member
From: Celje Slovenia
Registered: 2012-09-02
Posts: 93

interfaced based service exception and Parameters return

Hi,  (Rio10.3.3 ent, mormot latest)

we noticed that when we implement exception in service call that returned
parameters are not properly returned. Is this intentional?

  TAllParkHTTPResponeType = (
            response_OK,                       
            response_InvalidDeviceID,        
            response_DeviceTimeout,         
            ...
            );
...

    procedure SomeCallWithExceptionInside(const DeviceID: integer;out Park: TParkingsArray; out Err:TAllParkHTTPResponeType);

Err is internally set before exception, but on the client side's out Err value is wrong.

thank you,
Vojko Cendak

Last edited by VojkoCendak (2020-02-04 13:31:55)

Offline

#2 2020-02-05 09:22:33

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: interfaced based service exception and Parameters return

Exceptions should be trapped on the server side, and the error code should be explicitly set in the "except" block.

See https://synopse.info/files/html/Synopse … l#TITL_165

Offline

#3 2020-02-05 18:19:19

VojkoCendak
Member
From: Celje Slovenia
Registered: 2012-09-02
Posts: 93

Re: interfaced based service exception and Parameters return

Thank you,

The exception is generated serverside and trapped on clientside:

server side:

procedure TSomeService.myProcWithException(... ; out Err:TSomeEnum);
begin
  ...
  ...
  if SomeCondition then begin
    Err := MyValueForError;   //==> here I set it serverside, but it's value isn't transmitted to client(it stays default enum) !
    Raise Exception.Create('my error message');  //==>
  end;
end; 

client side:

  try
    ...
    RestSvc.myProcWithException(...., Err);  //== here exception happens, but Err is not valid
    ...
 except on E: Exception do begin
    ReportErrorValue := Err; // here err is not valid !
 end;
 end;

Question is whether out parameter Err should be transitted as set on server side in
case of exception.

Thank you, Vojko

Offline

#4 2020-02-05 19:10:40

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: interfaced based service exception and Parameters return

Exceptions are not propagated from the server.


Please check the documentation link I wrote above.

Offline

Board footer

Powered by FluxBB