All Questions
Tagged with error-handling http
30 questions
1
vote
1
answer
3k
views
Spring boot: better way to handle response and exceptions
I am working on a quite a big Spring Boot web service and I wanted a standardized and simplified way to handle responses and exceptions by following fluent API design.
So this is what I did and it ...
2
votes
1
answer
604
views
Modify original JSON few times and post http request
Follow up question from here.
I am working on a project where I need to do below things in Python:
Take few input parameters like - environmentName, ...
8
votes
1
answer
287
views
Post json using http and verify whether all actions completed successfully or not
I am working on a project where I need to work with http apis and call them using Python language. Below is what I need to do:
Take few input parameters like - <...
2
votes
1
answer
1k
views
Part 2: Send HTTP request for each row in Excel table
This script was previously reviewed here: Send HTTP request for each row in Excel table (Part 1)
I've made the changes that were suggested in the Code Review answers as well as added a few of my own.
...
3
votes
0
answers
102
views
HTTP download function in Rust (async/await)
Why am I fighting the compiler? - Wrote this, which works, but I feel like I'm breaking every rule in the book:
...
3
votes
2
answers
99
views
Generic function that accepts both Actions and Func's as parameters
I've created a generic try catch I can apply throughout my code so I'm not repeating myself.
...
4
votes
1
answer
1k
views
Node.js http retry do while mechanism
I have implemented a simple do/while loop to handle a http request to a third-party. I don’t know when the data I receive will have elements in its array so I retry up to 10 times until the array ...
4
votes
2
answers
999
views
Fetching data through HTTP and caching JSON result in a file
The task is to fetch some JSON data from an API with a GET request. If the location is not available for any reason, read a cache file. Otherwise write the cache file for future use.
The following ...
7
votes
2
answers
4k
views
Customizing errors based on HTTP status code in golang
I want to collect errors and its causes by defining custom errors (HTTP status 40x & 50x). For example, if user's request was bad, I want more specific reasons for the error.
A customized error ...
1
vote
1
answer
748
views
HTTP download with dynamic reallocation and retries
This code is for downloading a file via winhttp lib, It's invoked by StartDownload function which tries to download n times before returning false if maximum tries ...
5
votes
0
answers
1k
views
Downloading images from Reddit using Python 3
I have been working on this small project in order to fetch top-notch images from Reddit. Overall I am pretty confident about the code below but I am not entirely sure about whether my error handling ...
0
votes
1
answer
117
views
Haskell Servant - login endpoint with two error states
Here is one a handler for dealing with logins, I've recently refactored it to try and make dealing with the different error cases a bit more elegant, though I still think there is room for improvement:...
3
votes
2
answers
4k
views
Timeout implementation of fetch
After doing some research on google i didn't find any good info on how to implement timeout with fetch (looks like there are multiple proposals but that's about it so nothing has implemented it). For ...
1
vote
1
answer
58
views
error management when parsing multiple floats
I am writing a handler to render a GIF of a Lorentz attractor. I need to parse floating point numbers from the some querystrings attached to the GIF path. If any of them are bad, I need to log an ...
0
votes
1
answer
787
views
Downloading images using a thread pool, with exception handling
I'm currently using a broad Exception handler in my code and I would like to remove this broad exception. Which exceptions should I handle? Are these exceptions generated in my function "func" or ...
8
votes
1
answer
7k
views
Elegantly handle github API requests exceptions
I have this code which creates a team using the github API and returns the team-id(success) or -1(failure).
My problem is with the error handling. When the request responses with an error status code ...
5
votes
2
answers
2k
views
Getting JSON data from an HTTP response using conditional binding
I am new to Swift and I am trying to use the optional binding feature in as efficient way as possible but I am a bit confused on how to use it (if I can) in this scenario:
...
1
vote
2
answers
2k
views
Asynchronous lookup over HTTP and checking the status
For some reason declaring ApiResult before checking if the answer is in a correct status doesn't look good. I wonder if there is any better way to check the status ...
6
votes
2
answers
5k
views
Single class which holds response and error message
I am working on a library which will make HTTP call to my rest service basis on inputs passed to this library. And whatever response comes back from service whether it is successful response or ...
2
votes
3
answers
9k
views
Retrying a web request in Python
Is it fine to retry a web service call like this in Python? Would there be any scenarios the exception might not work the way we expect it? I expect it to continue only if it's fine, otherwise just ...
0
votes
1
answer
221
views
Retry storing HTTP response into a variable until specific code
I want to keep trying to get response until its code is 200 or unknown yet. In first case it should be stored in response variable. In another case I should raise ...
7
votes
1
answer
337
views
Calling other machines from the LinkedList if one is blocked or down
This is a follow on to : Simplifying asynchronous "executeAsync" method along with "onFailure" callback.
I am using AsyncRestTemplate as my <...
8
votes
3
answers
2k
views
Simplifying asynchronous "executeAsync" method along with "onFailure" callback
I have a system in which user id is "sharded" across all the machines which means each machine is responsible for certain user id data. I am working on a library which will take ...
2
votes
1
answer
264
views
Logging of various exceptions in the callback
I am working on a library in which I need to execute my URL using AsyncRestTemplate and after that I will get a json response back if it is successful. I am also making ...
4
votes
1
answer
172
views
Custom 503 page for MySQLi connection error
I redirect all my requests to index.php via htaccess and the code below is in my index.php.
Is this code properly set for a custom 503 page for an unsuccessful MySQLi connection trial?
Is it also ...
7
votes
2
answers
505
views
Exception handling for HTTP request timer
This method is used to check a URL and return the time it takes to check and the HTTP status code:
...
8
votes
2
answers
9k
views
Retry loop for asynchronous HTTP requests
I've got a method that needs to PUT data to a web API. Sometimes the connection fails, so I needed a way to do retries, but if the retries fail, I still need to capture the exception and re-throw it.
...
3
votes
2
answers
162
views
JSON fetcher for Eclipse plugin
This is a client module of an Eclipse plugin. I am planning to use this code as a "good exception handling" code example in one of my papers. How does it look?
...
8
votes
3
answers
53k
views
HttpURLConnection response code handling
This snippet from a downloader callable handles HTTP status codes. I need critique on both the style (for or do-while loop ...
11
votes
3
answers
552
views
Exception handling, et al - How do I make this web downloader not "poor"?
I haven't done Java coding in years, but I thought I would give it a shot for a job interview. I have a few questions:
Why is this error handling considered poor? How am I supposed to be doing it?
...