Detect unexpected end of stream
gabimem opened this issue · comments
This tool is quite useful for me to synchronize products in my ecommerce, but I need to be able to detect when a transmission ended unexpectedly, in order to cancel the operation.
For example:
This is the format used
{
"status": "success",
"data": [
{"id": 1, "name": ...},
{"id": 2, "name": ...},
{"id": 3, "name": ...},
{"id": 4, "name": ...},
.
.
.
{"id": N, "name": ...}
]
}
But when the transmission ends unexpectedly, the format is truncated
{
"status": "success",
"data": [
{"id": 1, "name": ...},
{"id": 2, "name": ...},
{"id": 3, "name": ...},
{"id": 4, "name": ...},
.
.
.
{"id": X, "name": ...}
Note sometimes the object of the last item is complete, so there is no format error.
When processing, this library ignores that unexpected ending, I need to be able to detect that the json format has not finished correctly.
Is this possible to do?
It would be ideal to throw an exception in that case.
Thank you
Resolved in 0.4.0