summaryrefslogtreecommitdiffstats
path: root/src/server/events/CreatePatch.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-03-12 02:28:21 +0000
committerDavid Robillard <d@drobilla.net>2012-03-12 02:28:21 +0000
commite9d9569271ee962c09ab66c6babed1ca5655a6c6 (patch)
treef77142b08c2bf2488eb382e993da1477c0b94307 /src/server/events/CreatePatch.cpp
parent7835b3d8c9b5b4a6f4959f56083d62826e6f7b8e (diff)
downloadingen-e9d9569271ee962c09ab66c6babed1ca5655a6c6.tar.gz
ingen-e9d9569271ee962c09ab66c6babed1ca5655a6c6.tar.bz2
ingen-e9d9569271ee962c09ab66c6babed1ca5655a6c6.zip
Unify event response mechanism and make it more appropriate for wire transmission.
The downside being more cryptic error messages until the client side error reporting stuff gets more fancy, but the important part is that belongs client side. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4053 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/events/CreatePatch.cpp')
-rw-r--r--src/server/events/CreatePatch.cpp31
1 files changed, 5 insertions, 26 deletions
diff --git a/src/server/events/CreatePatch.cpp b/src/server/events/CreatePatch.cpp
index eda05ccd..6e261755 100644
--- a/src/server/events/CreatePatch.cpp
+++ b/src/server/events/CreatePatch.cpp
@@ -55,13 +55,13 @@ void
CreatePatch::pre_process()
{
if (_path.is_root() || _engine.engine_store()->find_object(_path) != NULL) {
- _error = OBJECT_EXISTS;
+ _status = EXISTS;
Event::pre_process();
return;
}
if (_poly < 1) {
- _error = INVALID_POLY;
+ _status = INVALID_POLY;
Event::pre_process();
return;
}
@@ -70,7 +70,7 @@ CreatePatch::pre_process()
_parent = _engine.engine_store()->find_patch(path.parent());
if (_parent == NULL) {
- _error = PARENT_NOT_FOUND;
+ _status = PARENT_NOT_FOUND;
Event::pre_process();
return;
}
@@ -126,32 +126,11 @@ CreatePatch::execute(ProcessContext& context)
void
CreatePatch::post_process()
{
- string msg;
- switch (_error) {
- case NO_ERROR:
- respond_ok();
+ respond(_status);
+ if (!_status) {
// Don't send ports/nodes that have been added since prepare()
// (otherwise they would be sent twice)
_engine.broadcaster()->send_object(_patch, false);
- break;
- case OBJECT_EXISTS:
- respond_ok();
- /*string msg = "Unable to create patch: ";
- msg.append(_path).append(" already exists.");
- respond_error(msg);*/
- break;
- case PARENT_NOT_FOUND:
- msg = "Unable to create patch: Parent ";
- msg.append(Path(_path).parent().str()).append(" not found.");
- respond_error(msg);
- break;
- case INVALID_POLY:
- msg = "Unable to create patch ";
- msg.append(_path.str()).append(": ").append("Invalid polyphony requested.");
- respond_error(msg);
- break;
- default:
- respond_error("Unable to load patch.");
}
}