kogmbh/WebODF — pull request #239 by kossebau (2013-12-03 16:16:11+00:00)
Title: Escalate errors and state change events into the Editor API

Currently in the editor code, especially with the pullbox backend, most errors or critical states that could happen are not catched and leave the editor in an undefined state, also without signalling that properly.

This PR has a set of methods which tries to improve things, by catching and handling most errors and signalling them up to the Editor API, so apps like OwnCloud Documents can give them custom handling and presentation in the UI.
Additionally also the start and end of saving to the file with the pullbox scenario is signalled.

Handled errors:
* op returned false on execution
* OT returned null
* server rejects access to the session
* reply from server could not be parsed
* server send a defined error message

Handled warnings:
* server cannot be reached
* have unsynced local changes

This is a first approach to handling errors and state signalling. Hopefully will be improved by the time.
There might be still loop-holes or improvable API design, I do at least not feel happy with these commits.
E.g. where and how to define the event ids or error ids is a TODO, some I wrote as literal strings for now.