@@ -159,12 +159,14 @@ Result<std::shared_ptr<DataType>> VariableShapeTensorType::Deserialize(
159159 if (document.HasMember (" permutation" )) {
160160 const auto & json_permutation = document[" permutation" ];
161161 if (!json_permutation.IsArray ()) {
162- return Status::Invalid (" permutation must be an array" );
162+ return Status::Invalid (" permutation must be an array, got " ,
163+ internal::JsonTypeName (json_permutation));
163164 }
164165 permutation.reserve (ndim);
165166 for (const auto & x : json_permutation.GetArray ()) {
166167 if (!x.IsInt64 ()) {
167- return Status::Invalid (" permutation must contain integers" );
168+ return Status::Invalid (" permutation must contain integers, got " ,
169+ internal::JsonTypeName (x));
168170 }
169171 permutation.emplace_back (x.GetInt64 ());
170172 }
@@ -174,12 +176,14 @@ Result<std::shared_ptr<DataType>> VariableShapeTensorType::Deserialize(
174176 if (document.HasMember (" dim_names" )) {
175177 const auto & json_dim_names = document[" dim_names" ];
176178 if (!json_dim_names.IsArray ()) {
177- return Status::Invalid (" dim_names must be an array" );
179+ return Status::Invalid (" dim_names must be an array, got " ,
180+ internal::JsonTypeName (json_dim_names));
178181 }
179182 dim_names.reserve (ndim);
180183 for (const auto & x : json_dim_names.GetArray ()) {
181184 if (!x.IsString ()) {
182- return Status::Invalid (" dim_names must contain strings" );
185+ return Status::Invalid (" dim_names must contain strings, got " ,
186+ internal::JsonTypeName (x));
183187 }
184188 dim_names.emplace_back (x.GetString ());
185189 }
@@ -189,7 +193,8 @@ Result<std::shared_ptr<DataType>> VariableShapeTensorType::Deserialize(
189193 if (document.HasMember (" uniform_shape" )) {
190194 const auto & json_uniform_shape = document[" uniform_shape" ];
191195 if (!json_uniform_shape.IsArray ()) {
192- return Status::Invalid (" uniform_shape must be an array" );
196+ return Status::Invalid (" uniform_shape must be an array, got " ,
197+ internal::JsonTypeName (json_uniform_shape));
193198 }
194199 uniform_shape.reserve (ndim);
195200 for (const auto & x : json_uniform_shape.GetArray ()) {
@@ -198,7 +203,8 @@ Result<std::shared_ptr<DataType>> VariableShapeTensorType::Deserialize(
198203 } else if (x.IsInt64 ()) {
199204 uniform_shape.emplace_back (x.GetInt64 ());
200205 } else {
201- return Status::Invalid (" uniform_shape must contain integers or nulls" );
206+ return Status::Invalid (" uniform_shape must contain integers or nulls, got " ,
207+ internal::JsonTypeName (x));
202208 }
203209 }
204210 }
0 commit comments