Httpapi 500 error

I’ve created a DA and httpapi server (delphi 10.4.1, DA 10.0.0.1495 ).
Mainly used case is in app i call it to get data and update data.

Sometimes I get a 500 error at httpAPI call. Once I hit the 500 error, no matter I call which httpapi function in other/same service, it also return 500.
The server works again when I restart the server.

As I dont know which function trigger the error, any additioanl information or error message I get know on it?

Any Global exception Exception I can log those error?

Joe

Hi,

you can change httpserver.SendExceptionsAs500 to False.
In this case you will see internal exception.

another way: create descendant of http server and override the ProcessRequest method.
in overridden method you can check IROHTTPResponse.Code and if it is 500, you can log all necessary info. it can be grabbed from aTransport & aRequestStream.

object ROServer: TROIndyHTTPServer
Dispatchers = <
item
Name = ‘ROMessage’
Message = ROMessage
Enabled = True
PathInfo = ‘Bin’
end
item
Name = ‘ROJSONMessage1’
Message = ROJSONMessage1
Enabled = True
PathInfo = ‘JSON’
end>
SendClientAccessPolicyXml = captAllowAll
ServeInfoPage = False
SendCrossOriginHeader = True
IndyServer.Bindings = <>
IndyServer.DefaultPort = 8199
Port = 8199
Left = 48
Top = 160
end

I already set sendexceptionsAs500 to true but I cant find any exception. How can I know the internal exception?

Hi,

sorry, typo. set it to False.
when exception will be raised, internal error will be added to response.

ok thanks I try to find the issue. Thanks