Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.
HTTP_Services
in a http_..... ssp I am doing:
HTTP_Services('SetResponseStatus'.........
What is the correct method to see if any errors have been set before continuing with your logic
e.g. if error_services('NoError') then
does this also pickup errors set in HTTP_Services or only those set using error_services.
HTTP_Services('SetResponseStatus'.........
What is the correct method to see if any errors have been set before continuing with your logic
e.g. if error_services('NoError') then
does this also pickup errors set in HTTP_Services or only those set using error_services.
Comments
Good question. I should explain the purpose of Error_Services within the HTTP Framework and then answer your question.
Error_Services is mainly used to set internal errors. We use this service just about everywhere within all of our SRP FrameWorks development. It's basically our replacement to the OI error trapping mechanisms. We like it because it follows a different philosophy. Basically, it always clears the error before you run your next service to avoid interference. Most of the OI error trapping mechanisms hold on to this condition and then interfere with the proper functionality of a subsequent call to a routine. This is why it is always necessary to do a Set_Status(0). We think that is cumbersome and unnecessary.
So, you should use Error_Services when you want to trap something like problems opening a table or something else that is unexpected. It should not be used to track HTTP service errors, such as when the client makes an invalid service request. That what the SetResponseStatus service is for.
If you have already set the status and you want to verify what you set, just use the GetResponseStatus service. Note, however, that if you have not already performed a SetResponseStatus, then GetResponseStatus will automatically return 200. This is a safety net for your API.