After all, as a developer, you don't have to care about the exact API error. Using this approach gives you an easy way out. This is exactly, because developers used a generic try.catch statement. I bet you've seen an error similar to An error has occurred. If calling an API fails for whatever reason, the app catches the error and shows a generic error. Probably the most frequently used solution out there is to wrap the whole web request in a try.catch clause. Here's how developers typically deal with it. And having proper docs that describe erroneous behavior makes all the difference. But if you've worked with APIs a bit, you know that API failure is not a matter of "if" but "when". "It's a matter of perception" - you could say. What makes it even harder, is that vendors who publish APIs, often spend more time in their docs communicating how their APIs work rather than how their APIs behave when they fail. What is really hard about working with APIs is simulating different error states, like rate limits, throttling or servers getting overloaded. Yes, you can easily send an invalid request and see it respond with an error, but that's hardly something you'd see in production, unless you missed something fundamental. While it's easy to get APIs to work, it's hard to break them. We can even go as far as to automate testing different scenarios relevant to our app. Using their docs, we can integrate these APIs in our apps just fine. Each API works differently than the other. The APIs we use in our apps are built by different vendors. And yet, it's surprising to see how hard it still is to build robust apps that use APIs. We use APIs for everything: from authentication, to data storage, to integrating AI. It's hard to imagine an app that's not connected to an API these days. What if your API-handling code is more elaborate? What if you want to use rate limiting headers to back off and avoid getting throttled? And when you get throttled, you want to wait for the designated period and retry the request automatically? How do you verify that your code works correctly? Using APIs is hard More specifically, how would you verify that the code in the catch clause, responsible for handling errors is working properly? This will also help us improve the error messaging in CORE and we may add a specific message in future updates.Async function getData () Someone will get in touch with you and let you know the exact reason for the error. In such cases, you should contact our Support Team or post it on CORE Community. Sometimes, the server may respond with a generic “API Error” message, and you may not know the exact reason due to which the action was not allowed. Usually, the API server responds to CORE with a specific error message that lets you know the exact reason for not allowing the action, e.g., You do not have the security permission to access this feature. Permanent API errors: This category includes all those scenarios where the action you are trying to perform in CORE is not allowed by the APIs and, therefore, fails to execute.If you do not find anything on the status page, you should contact our Support Team to find out the exact reason for the error. In such scenarios, you should always start by checking our status page and see if any maintenance activities are going on. For example, you may get an API error when trying to log in to CORE. This can happen if there is a temporary issue with our servers and it is usually fixed promptly. Temporary API errors: This category includes all those scenarios where the action you are trying to perform in CORE was previously executing successfully, but now it is failing to execute and returns an API error message.There are many scenarios in which this can happen, but we can group them into two main categories: In such cases, you may receive an API error message in CORE. This indicates that the request has failed, and the action is not completed. However, sometimes there may be no response or an error response. The server responds to an API request with a success code indicating the action is completed successfully. Any actions you perform in CORE are dependent on the responses to the API requests it sends to our API server.
0 Comments
Leave a Reply. |