Alfaplus
Alfaplus

Reputation: 1723

Json value not expected

There is a communication between WS and my app. This data exchage is doing through a JSON object which is sending an attributes with null as a value.

The App was trusting blindly. JSON values were not checked and were written directly into the local DB. Then the app throw an exception.

I would like to know who has the reponsability of the error?

WS that has sent a unexpected value or the App should manage this value.

I have chosen to handle the values in the app.

Upvotes: 0

Views: 224

Answers (1)

eleven
eleven

Reputation: 6847

  1. The primary task of a client is not to crash due to any problem.
  2. If client can't parse received data it must log error and only if it's critical problem notify user about it.
  3. A client should be ready to receive any data from server.

Upvotes: 1

Related Questions