File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -45,9 +45,13 @@ absl::Status TypeInferenceErrorStatusInternal(
4545 if (type_or_annotation != nullptr ) {
4646 type_str = type_or_annotation->ToString () + " " ;
4747 }
48- return absl::InvalidArgumentError (
49- absl::StrFormat (" TypeInferenceError: %s %s%s" , span.ToString (file_table),
50- type_str, message));
48+
49+ absl::Status status = absl::InvalidArgumentError (
50+ absl::StrFormat (" TypeInferenceError: %s%s" , type_str, message));
51+ StatusPayloadProto payload;
52+ *payload.add_spans () = ToProto (span, file_table);
53+ SetStatusPayload (status, payload);
54+ return status;
5155}
5256
5357} // namespace
Original file line number Diff line number Diff line change @@ -42,10 +42,12 @@ TEST(ErrorsTest, TypeInferenceErrorMessage) {
4242 std::unique_ptr<Type> type = BitsType::MakeU32 ();
4343 absl::Status status = TypeInferenceErrorStatus (
4444 span, type.get (), " this is the message!" , file_table);
45- EXPECT_EQ (
46- status.ToString (),
47- " INVALID_ARGUMENT: TypeInferenceError: <no-file>:1:1-2:2 uN[32] this "
48- " is the message!" );
45+ std::optional<StatusPayloadProto> payload = GetStatusPayload (status);
46+ ASSERT_TRUE (payload.has_value ());
47+ EXPECT_THAT (payload->spans (),
48+ UnorderedElementsAre (EqualsProto (ToProto (span, file_table))));
49+ EXPECT_EQ (status.message (),
50+ " TypeInferenceError: uN[32] this is the message!" );
4951}
5052
5153TEST (ErrorsTest, SignednessMismatchErrorAnnotationPayload) {
You can’t perform that action at this time.
0 commit comments