I have a custom connector which points to an API. Reading or writing to the API seems to work as expected but I would like to handle any errors that may occur.
Is this even possible?
I have searched the community and seen some references mentioning this type of functionality but they are from last year and do not explain how to gain access to the specific error returned by the API.
Can anyone help?
We can achieve this by using custom connector code to manipulate request and response (based on http status code). only drawback is backend API wait timeout will reduce from 2 minutes to 5 seconds, if your enabling code in custom connector
To my awareness, that is not possible, if you can control the API, the API must likely have to be modified to always return the 200 response and you probably need to abstract away the actual error code elsewhere in the API. Reason is because any other code such as an error status code is interpreted as if it were an internal error in the Custom Connector. Then the Custom Connector will actually retry the connection instead, not pass through and return an error message. I do not believe this can be changed.
If you are trying to check for if there is an internal error (e.g. usually because the actual backend behind the Custom Connector is down), that is possible with an advanced way with IfError, but it requires experimental features to be enabled to do this, and you cannot get the Error message at all, this is just to check if any error was returned, so this way with the experimental one, it can be detected if the Custom Connector backend could never be contacted after the several attempts it would make.
See Ref: Error, IfError, IsError, IsBlankOrError
No exact error code can be obtained this way. It is just a trick to be able to find out if the Custom Connector could never contact the backend in the first place. If you try this it would have to be used with an advanced way with Timers. If your API returns any error status code, it will probably be misinterpreted as this kind of situation too - the API cannot return any error HTTP status codes to my awareness.
Note that the above is the only thing I am aware you can do and it is not related directly to what you are asking. About what you are asking, The first part where the API must return 200 status code is only way I know of and no way around it.
WarrenBelz
211
Most Valuable Professional
MS.Ragavendar
108
stampcoin
80