forked from osmocom/wireshark
dfilter: Improve some error messages
This commit is contained in:
parent
fb490eb172
commit
2d45cb0881
|
@ -1131,7 +1131,7 @@ check_relation_matches(dfwork_t *dfw, stnode_t *st_node,
|
|||
const char *patt;
|
||||
|
||||
if (stnode_type_id(st_arg2) != STTYPE_STRING) {
|
||||
dfilter_fail(dfw, "Expected a string not %s", stnode_todisplay(st_arg2));
|
||||
dfilter_fail(dfw, "Expected a double quoted string not %s", stnode_todisplay(st_arg2));
|
||||
THROW(TypeError);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,12 @@ string_tostr(const void *data, gboolean pretty)
|
|||
return g_strdup(data);
|
||||
}
|
||||
|
||||
static char *
|
||||
unparsed_tostr(const void *data, gboolean pretty _U_)
|
||||
{
|
||||
return g_strdup(data);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
sttype_register_string(void)
|
||||
|
@ -54,7 +60,7 @@ sttype_register_string(void)
|
|||
string_new,
|
||||
string_free,
|
||||
string_dup,
|
||||
string_tostr
|
||||
unparsed_tostr
|
||||
};
|
||||
|
||||
sttype_register(&string_type);
|
||||
|
|
|
@ -41,7 +41,7 @@ class case_range(unittest.TestCase):
|
|||
|
||||
def test_slice_unparsed_1(self, checkDFilterFail):
|
||||
dfilter = "a == b[1]"
|
||||
checkDFilterFail(dfilter, "Range is not supported for entity \"b\" of type UNPARSED")
|
||||
checkDFilterFail(dfilter, "Range is not supported for entity b of type UNPARSED")
|
||||
|
||||
def test_slice_func_1(self, checkDFilterSucceed):
|
||||
dfilter = "string(ipx.src.node)[3:2] == \"cc:dd\""
|
||||
|
|
|
@ -37,7 +37,7 @@ class case_syntax(unittest.TestCase):
|
|||
|
||||
def test_matches_2(self, checkDFilterFail):
|
||||
dfilter = 'http.request.method matches HEAD'
|
||||
checkDFilterFail(dfilter, 'Expected a string')
|
||||
checkDFilterFail(dfilter, 'Expected a double quoted string')
|
||||
|
||||
def test_matches_3(self, checkDFilterFail):
|
||||
dfilter = 'http.request.method matches "^HEAD" matches "^POST"'
|
||||
|
|
Loading…
Reference in New Issue