All Questions
Tagged with error-handling json
15 questions
5
votes
0
answers
1k
views
Exception handling: using @JsonProperty value to make error message
If the validation in RestController fails, I need to handle MethodArgumentNotValidException and provide an errorMessage, that ...
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 - <...
4
votes
1
answer
789
views
Should my Json storage handle exceptions?
I made a class to conviniently serialize/deserialize data. Now I'm stuck with the following question. Should I handle exceptions (use try-catch) inside JsonStorage ...
0
votes
2
answers
48
views
Printing the status of a database insertion as JSON
The controller is currently inserting a record into the database and returning a JSON response as shown below in the try-catch block. I can see the ...
0
votes
1
answer
290
views
Python client to fetch JSON data from REST API, retrying on failure
As a beginner, I'd like to see if anyone can suggest any better way of coding the below, as I'm duplicating code and nesting identical if statements as part of the following problem.
I'm grabbing ...
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 ...
1
vote
1
answer
1k
views
utility class for reading in JSON
I'm reasonably happy with the execution:
...
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:
...
2
votes
2
answers
2k
views
Program to edit an address book stored as a JSON file
I'm trying my hand at an address book and the goal is for it to have a bit more of error prevention. For instance, for the key "phone" to have 10 digits, and not allow alpha characters at section 4. I ...
2
votes
2
answers
220
views
RSS to JSON for insertion into MongoDB
In my code, there is a chain of functions call where the deepest function may throw an exception. I catch and handle it according to the business logic. The problem is that all other functions in the ...
0
votes
2
answers
440
views
Concatenating multiple strings from a JSON response
I would like to concatenate a series of strings populated from an XHR response. So, I've chosen to do it like this:
...
2
votes
0
answers
83
views
Restful API for parsing records
I'm trying to implement my own API. This code excerpt should show the basic working routines. The storage is temporary an in-memory-array and the only HTTP method for now is POST.
I outsourced the ...
7
votes
2
answers
7k
views
Handling parsing failure in Scala without exceptions
I have a Scala (Play!) application that must get and parse some data in JSON from an external service. I want to be able to gently handle failure in the response format, but it is becoming messy. What ...
8
votes
3
answers
3k
views
Catching multiple types of exceptions when writing JSON
I have a class which throws a lot of exceptions:
...