How to get the full api error list using monday js sdk?

Hi,

I am struggling to maintain api’s error messages using app sdk aka monday.api(query).
I am developing a client side react application and I am using monday.api(query) to do http request. For success scenarios there is no problem I can get the payload. But for error scenarios such as rate limit problems I can’t get the full json payload which should contain status code, error code etc. When there is an error scenario it returns like the following:

As you see it only contains the message as string. And this is the returning actual payload from the server including all information that I need. I took the SS from Chrome’s developer tools.

Here is my code:

    Monday.api('query goes here')
        .then(success_fn, function (err) {
            console.log(err.data)
        })

My library versions. I assume I am using the latest versions.

├── @mondaycom/apps-cli@2.4.0
├── @mondaycom/apps-sdk@3.0.2
├── monday-sdk-js@0.5.5
├── monday-ui-react-core@2.104.0

My api version is 2024-07.

My use case is just to retry the request in case of the fact that there is rate limit error. So I need status_code and error_code information. Parsing the raw string is not promising since it is subject to change and it is anti-pattern.

So the question is how can I get the full error payload that is returning from the server using Monday SDK?

Thanks in advance.

1 Like

Is there any progress on this? I need badly the full payload.

Hello there @apsimos,

In this case, this error message is shown with a 200 OK status. So I don’t think that information would be relevant to you.

You can see that the errors object is in the response, and then you can look for the word “Complexity” in the error message. We should not change the message without previous notice. This is just a workaround I thought.

Maybe someone else in the community is handling this in a different way, if so, please come join the topic!

Hi @Matias.Monday,

Thanks for your comment. Still I can not understand why is not the full error response is not shown in the error message? Parsing the raw error message is anti-pattern I guess.

Best,

I am handling it through parsing the message, that said, my primary method is not to hit the limits at all. But since I’m doing integration apps all the work is happening on my back end, its not distributed across many clients.

I just track how much everything will consume and the current budget consumed and if something would exceed the budget I return a 429 and monday retries a minute later. This way I never have anything sitting in my back end waiting around. It also means I don’t have to queue things on my side and return a success to monday (when its not yet done) and create a false impression in the automation activity log. It continues to show in progress.

1 Like

Hi @anon29275264,

I got your point. But parsing the error message is not the desired way since it is subject to change. There has been error_code and status_code already in the response payload. I am struggling to understand why I can’t reach those through the SDK. This is the question. Returning these data from SDK is dead simple. No extra effort is required.

Hello again @apsimos,

After checking with the team, I believe you could solve this by using the Monday GraphQL JS SDK which should get you the full data :smile:

Because monday did not followed the graphql specification for many of its errors. I have been told its on the road map to rectify this. But I do not have specific details. In the meantime we have to work around those limitations. It is what it is.

Thanks @anon29275264 and @Matias.Monday,

@Matias.Monday unfortunately I am not able to use this SDK since it requires a private access token. My app is a client side application not a server side. I think I have to follow @anon29275264’s recommendation.