diff --git a/CHANGES b/CHANGES index c4d2d26a68..44d8cf4c93 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,8 @@ +2.6-279 | 2019-05-13 20:02:59 -0700 + + * GH-365: improve un-indexable type error message (Jon Siwek, Corelight) + 2.6-277 | 2019-05-08 12:42:18 -0700 * Allow tuning Broker log batching via scripts (Jon Siwek, Corelight) diff --git a/VERSION b/VERSION index 64298b5057..1268552eaf 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.6-277 +2.6-279 diff --git a/src/Expr.cc b/src/Expr.cc index e6cb9937c4..efbd96f04f 100644 --- a/src/Expr.cc +++ b/src/Expr.cc @@ -2917,7 +2917,12 @@ IndexExpr::IndexExpr(Expr* arg_op1, ListExpr* arg_op2, bool is_slice) int match_type = op1->Type()->MatchesIndex(arg_op2); if ( match_type == DOES_NOT_MATCH_INDEX ) - SetError("not an index type"); + { + std::string error_msg = + fmt("expression with type '%s' is not a type that can be indexed", + type_name(op1->Type()->Tag())); + SetError(error_msg.data()); + } else if ( ! op1->Type()->YieldType() ) {