Replies: 2 comments 1 reply
-
It doesn’t look like theres supports for that currently. One option is to proxy or wrap the API so it always returns a 200 and includes the status in the body. That way you can branch on the response safely:
|
Beta Was this translation helpful? Give feedback.
1 reply
-
This has come up a lot with no moment on it, the above workaround of proxying it via something that handles failures, falls apart when that proxy has issues that you again cant handle. Along with the issue that you cant do more than around 50 http::* per second for a sustained duration - #6171 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
Is there an equivalent of a try catch statement in surrealQL?
I explain my situation. I have a table service (web service) .... each service has a /healt endpoint. I would like to have a field 'status' with type future containing 'OK' or 'KO' based on the result of che http:get() call.
Something like this:
CREATE service SET status = <'future'> {
}
It works well as long as the service is running... but as the documentation say " If the response does not return a 2XX status code, then the function will fail and return the error.". So if i execute the query to see which of my service is down...(KO) ..if one is really down i get an error and not the result...
It would be nice to try and catch the error ... something like :
CREATE service SET status = <'future'> {
}
Please help me find a way!
Thank you very much.
Beta Was this translation helpful? Give feedback.
All reactions