summaryrefslogtreecommitdiffstats
path: root/src/httpserver/qhttpserverrouterrule.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/httpserver/qhttpserverrouterrule.cpp')
-rw-r--r--src/httpserver/qhttpserverrouterrule.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/httpserver/qhttpserverrouterrule.cpp b/src/httpserver/qhttpserverrouterrule.cpp
index 032287a..d486218 100644
--- a/src/httpserver/qhttpserverrouterrule.cpp
+++ b/src/httpserver/qhttpserverrouterrule.cpp
@@ -175,10 +175,19 @@ bool QHttpServerRouterRule::createPathRegexp(const std::initializer_list<int> &m
QString pathRegexp = d->pathPattern;
const QLatin1String arg("<arg>");
for (auto type : metaTypes) {
+ if (type >= QMetaType::User
+ && !QMetaType::hasRegisteredConverterFunction(qMetaTypeId<QString>(), type)) {
+ qCWarning(lcRouterRule) << QMetaType::typeName(type)
+ << "has not registered a converter to QString."
+ << "Use QHttpServerRouter::addConveter<Type>(converter).";
+ return false;
+ }
+
auto it = converters.constFind(type);
if (it == converters.end()) {
- qCWarning(lcRouterRule) << "can not find converter for type:" << type;
- continue;
+ qCWarning(lcRouterRule) << "can not find converter for type:"
+ << QMetaType::typeName(type);
+ return false;
}
if (it->isEmpty())