HTTP Responses
The Octave REST API uses the following error codes:
Error Code | Meaning |
---|---|
400 | Bad Request -- Your request is invalid. Check the request format and the data supplied. |
403 | Forbidden -- You do not have access to the given object. |
404 | Not Found -- The specified resource could not be found. |
Disabled Objects
Objects that act autonomously can also produce errors, either transient or systematic. For example a Cloud Action might fail due to a bug in the accompanying JavaScript code, or a Cloud Connector might be configured incorrectly. Sometimes errors will occur due to some issue outside of Octave, such as an unreachable remote server targeted by a Cloud Connector.
Persistent or unrecoverable errors will trigger the Object to be disabled and require corrective action from the user. Objects that can be disabled automatically include:
- Cloud Actions
- Cloud Connectors
- Tasks
When an Object is disabled by the system, the Object's disabled field will be set to true and it will no longer function. Cloud Actions and Cloud Connectors will no longer be triggered on any input Events, while Tasks will no longer trigger periodically.
{
"id": "a5d14b0e19ecf7e616d8486a8",
"description" : "A bad Action",
"disabled" : true,
...
}
Disable Notifications
A Notification will be generated in the Company Inbox Stream, according to the Object type:
Type | Stream |
---|---|
Cloud Action | /<company_name>/:inbox/cloud-actions |
Cloud Connector | /<company_name>/:inbox/cloud-connectors |
Task | /<company_name>/:inbox/tasks |
The Notification will contain the ID of the Object (in elems.sourceId
) and details of why the Object was disabled (in elems.details.message
and/or elems.details.lastErrors
).
Error monitoring
Monitoring the Notification Stream(s) is the best way for users to be warned when there is a problem.
{
"creationDate": 1601301755714,
"creatorId": "i000000000000000000000001",
"elems": {
"action": "DISABLE",
"actor": {
"firstName": null,
"id": "i5cfe411cfc3da877623ee684",
"lastName": null,
"name": "frank_smith"
},
"details": {
"lastErrors": [
{
"message": "TypeError: Cannot read property \"lat\" from undefined",
"timestamp": 1601301664875
},
{
"message": "TypeError: Cannot read property \"lat\" from undefined",
"timestamp": 1601301680023
},
{
"message": "TypeError: Cannot read property \"lat\" from undefined",
"timestamp": 1601301710121
},
{
"message": "TypeError: Cannot read property \"lat\" from undefined",
"timestamp": 1601301725548
},
{
"message": "TypeError: Cannot read property \"lat\" from undefined",
"timestamp": 1601301755647
}
],
"message": "TypeError: Cannot read property \"lat\" from undefined",
"source": "/foo/devices/bar/:default"
},
"kind": "NOTIFICATION",
"sourceId": "a5f6e26152940dfc3af59ecf4",
"type": "action"
},
...
}
Remediation
In order to re-enable a disabled Object, users should first correct the source of the error either by updating the JavaScript or some other property, then set the disabled property to false
. The Object will then begin functioning.
Causes
There are two kinds of error that will cause an Object to be disabled:
Critical Error
Non-transient errors that must be corrected immediately before operation can resume. For example, a Cloud Action that writes to a bad destination (non-existent or outside the company-scope).
An Object will be disabled immediately when a single unrecoverable error is raised.
Standard Error
All other errors, which could either be systematic or transient, such as JavaScript errors or HTTP connection errors.
Octave will continue operate the Object until it has failed repeatedly (at least 4 consecutive failures).