Success and Failure
From The Socknet
Socknet communication is achieved via HTTP and HTTPS GETs and POSTs.
Some messages will have responses in JSON.
A successful function call will respond with either:
- nothing
- JSON code specific to the function being accessed
A failed function call will respond with a JSON error message.
Example:
{ errors: [
{
title: "some text",
explanation: "some more text",
code: ###
}
]
}
An error response includes an errors field holding an array of objects.
An error object may include a title field holding a string.
An error object may include an explanation field holding a string.
An error object may include a code field holding a string.
Function developers are encouraged to develop standards for the fields title, exlanation, and code for each function.
And error object may have other fields specific to the error type.
In addition to errors within the code, connection errors and other HTTP errors can occur. Socknet libraries should give options for dealing with this.
Considerations
In many cases, it is desirable to reach data in a different format than JSON. This should be accomplished by including a URL in JSON format to the resource. All Socknet functions must respond with JSON or nothing.
In many error cases, the call should be reattempted later. It is suggested to use a "spool" pattern for this purpose.

