summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-12-30 15:46:35 +0000
committerDavid Robillard <d@drobilla.net>2009-12-30 15:46:35 +0000
commit87be66d677b1947ef1b5f866c44b0beb1263ac17 (patch)
treea8269bb2343bbc32a2e129e983d0e26301f6608f
parent75527443361902ff924ddd01755b9268fcb97b2b (diff)
downloadingen-87be66d677b1947ef1b5f866c44b0beb1263ac17.tar.gz
ingen-87be66d677b1947ef1b5f866c44b0beb1263ac17.tar.bz2
ingen-87be66d677b1947ef1b5f866c44b0beb1263ac17.zip
Better error reporting for bad PUT.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2323 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/engine/events/SetMetadata.cpp22
-rw-r--r--src/engine/events/SetMetadata.hpp9
2 files changed, 23 insertions, 8 deletions
diff --git a/src/engine/events/SetMetadata.cpp b/src/engine/events/SetMetadata.cpp
index 7d9b5fa5..e058b1f4 100644
--- a/src/engine/events/SetMetadata.cpp
+++ b/src/engine/events/SetMetadata.cpp
@@ -115,7 +115,7 @@ SetMetadata::pre_process()
if (_create_event)
_create_event->pre_process();
else
- _error = BAD_TYPE;
+ _error = BAD_OBJECT_TYPE;
QueuedEvent::pre_process();
return;
}
@@ -151,20 +151,20 @@ SetMetadata::pre_process()
if (value.get_bool() && !_patch->compiled_patch())
_compiled_patch = _patch->compile();
} else {
- _error = BAD_TYPE;
+ _error = BAD_VALUE_TYPE;
}
} else if (key.str() == "ingen:polyphonic") {
if (value.type() == Atom::BOOL) {
op = POLYPHONIC;
} else {
- _error = BAD_TYPE;
+ _error = BAD_VALUE_TYPE;
}
} else if (key.str() == "ingen:polyphony") {
if (value.type() == Atom::INT) {
op = POLYPHONY;
_patch->prepare_internal_poly(*_engine.buffer_factory(), value.get_int32());
} else {
- _error = BAD_TYPE;
+ _error = BAD_VALUE_TYPE;
}
}
} else if (key.str() == "ingen:value") {
@@ -179,8 +179,10 @@ SetMetadata::pre_process()
}
}
- if (_error != NO_ERROR)
+ if (_error != NO_ERROR) {
+ _error_predicate += key.str();
break;
+ }
_types.push_back(op);
}
@@ -264,8 +266,14 @@ SetMetadata::post_process()
case INTERNAL:
_responder->respond_error("Internal error");
break;
- case BAD_TYPE:
- _responder->respond_error("Bad type");
+ case BAD_OBJECT_TYPE:
+ _responder->respond_error((boost::format(
+ "Bad type for object '%1%'") % _subject).str());
+ break;
+ case BAD_VALUE_TYPE:
+ _responder->respond_error((boost::format(
+ "Bad metadata value type for subject '%1%' predicate '%2%")
+ % _subject % _error_predicate).str());
break;
}
}
diff --git a/src/engine/events/SetMetadata.hpp b/src/engine/events/SetMetadata.hpp
index cf33b5aa..dc67d162 100644
--- a/src/engine/events/SetMetadata.hpp
+++ b/src/engine/events/SetMetadata.hpp
@@ -82,7 +82,13 @@ public:
void post_process();
private:
- enum { NO_ERROR, NOT_FOUND, INTERNAL, BAD_TYPE } _error;
+ enum { NO_ERROR,
+ NOT_FOUND,
+ INTERNAL,
+ BAD_OBJECT_TYPE,
+ BAD_VALUE_TYPE
+ } _error;
+
enum SpecialType {
NONE,
ENABLE,
@@ -101,6 +107,7 @@ private:
Shared::ResourceImpl* _object;
PatchImpl* _patch;
CompiledPatch* _compiled_patch;
+ std::string _error_predicate;
bool _replace;
bool _is_meta;
bool _success;