@@ -51,7 +51,7 @@ namespace jsonrpccxx {
51
51
throw JsonRpcException (-32601 , " method not found: " + name);
52
52
}
53
53
try {
54
- return method->second (normalizeParameter (name, params));
54
+ return method->second (normalize_parameter (name, params));
55
55
} catch (json::type_error &e) {
56
56
throw JsonRpcException (-32602 , " invalid parameter: " + std::string (e.what ()));
57
57
} catch (JsonRpcException &e) {
@@ -65,15 +65,21 @@ namespace jsonrpccxx {
65
65
throw JsonRpcException (-32601 , " notification not found: " + name);
66
66
}
67
67
try {
68
- notification->second (normalizeParameter (name, params));
68
+ notification->second (normalize_parameter (name, params));
69
69
} catch (json::type_error &e) {
70
70
throw JsonRpcException (-32602 , " invalid parameter: " + std::string (e.what ()));
71
71
} catch (JsonRpcException &e) {
72
72
throw process_type_error (name, e);
73
73
}
74
74
}
75
75
76
- inline json normalizeParameter (const std::string &name, const json ¶ms) {
76
+ private:
77
+ std::map<std::string, MethodHandle> methods;
78
+ std::map<std::string, NotificationHandle> notifications;
79
+ std::map<std::string, NamedParamMapping> mapping;
80
+
81
+ inline bool contains (const std::string &name) { return (methods.find (name) != methods.end () || notifications.find (name) != notifications.end ()); }
82
+ inline json normalize_parameter (const std::string &name, const json ¶ms) {
77
83
if (params.type () == json::value_t ::array) {
78
84
return params;
79
85
} else if (params.type () == json::value_t ::object) {
@@ -91,11 +97,5 @@ namespace jsonrpccxx {
91
97
}
92
98
throw JsonRpcException (-32600 , " invalid request: params field must be an array, object" );
93
99
}
94
-
95
- private:
96
- std::map<std::string, MethodHandle> methods;
97
- std::map<std::string, NotificationHandle> notifications;
98
- std::map<std::string, NamedParamMapping> mapping;
99
- inline bool contains (const std::string &name) { return (methods.find (name) != methods.end () || notifications.find (name) != notifications.end ()); }
100
100
};
101
101
} // namespace jsonrpccxx
0 commit comments