@@ -57,7 +57,9 @@ func TestTransformDocument(t *testing.T) {
57
57
"unsupported type" ,
58
58
[]string {"foo" , "bar" },
59
59
nil ,
60
- MarshalError {Value : []string {"foo" , "bar" }, Err : errors .New ("invalid state transition: TopLevel -> ArrayMode" )},
60
+ MarshalError {
61
+ Value : []string {"foo" , "bar" },
62
+ Err : errors .New ("WriteArray can only write a Array while positioned on a Element or Value but is positioned on a TopLevel" )},
61
63
},
62
64
{
63
65
"nil" ,
@@ -162,7 +164,11 @@ func TestTransformAggregatePipeline(t *testing.T) {
162
164
arr bsonx.Arr
163
165
err error
164
166
}{
165
- {"Pipeline/error" , Pipeline {{{"hello" , func () {}}}}, bsonx.Arr {}, MarshalError {Value : primitive.D {}}},
167
+ {
168
+ "Pipeline/error" ,
169
+ Pipeline {{{"hello" , func () {}}}}, bsonx.Arr {},
170
+ MarshalError {Value : primitive.D {}, Err : errors .New ("no encoder found for func()" )},
171
+ },
166
172
{
167
173
"Pipeline/success" ,
168
174
Pipeline {{{"hello" , "world" }}, {{"pi" , 3.14159 }}},
@@ -188,7 +194,7 @@ func TestTransformAggregatePipeline(t *testing.T) {
188
194
"primitive.A/error" ,
189
195
primitive.A {"5" },
190
196
bsonx.Arr {},
191
- MarshalError {Value : string ("" )},
197
+ MarshalError {Value : string ("" ), Err : errors . New ( "WriteString can only write while positioned on a Element or Value but is positioned on a TopLevel" ) },
192
198
},
193
199
{
194
200
"primitive.A/success" ,
@@ -203,7 +209,7 @@ func TestTransformAggregatePipeline(t *testing.T) {
203
209
"bson.A/error" ,
204
210
bson.A {"5" },
205
211
bsonx.Arr {},
206
- MarshalError {Value : string ("" )},
212
+ MarshalError {Value : string ("" ), Err : errors . New ( "WriteString can only write while positioned on a Element or Value but is positioned on a TopLevel" ) },
207
213
},
208
214
{
209
215
"bson.A/success" ,
@@ -218,7 +224,7 @@ func TestTransformAggregatePipeline(t *testing.T) {
218
224
"[]interface{}/error" ,
219
225
[]interface {}{"5" },
220
226
bsonx.Arr {},
221
- MarshalError {Value : string ("" )},
227
+ MarshalError {Value : string ("" ), Err : errors . New ( "WriteString can only write while positioned on a Element or Value but is positioned on a TopLevel" ) },
222
228
},
223
229
{
224
230
"[]interface{}/success" ,
@@ -269,7 +275,7 @@ func TestTransformAggregatePipeline(t *testing.T) {
269
275
"array/error" ,
270
276
[1 ]interface {}{int64 (42 )},
271
277
bsonx.Arr {},
272
- MarshalError {Value : int64 (0 )},
278
+ MarshalError {Value : int64 (0 ), Err : errors . New ( "WriteInt64 can only write while positioned on a Element or Value but is positioned on a TopLevel" ) },
273
279
},
274
280
{
275
281
"array/success" ,
@@ -281,7 +287,7 @@ func TestTransformAggregatePipeline(t *testing.T) {
281
287
"slice/error" ,
282
288
[]interface {}{int64 (42 )},
283
289
bsonx.Arr {},
284
- MarshalError {Value : int64 (0 )},
290
+ MarshalError {Value : int64 (0 ), Err : errors . New ( "WriteInt64 can only write while positioned on a Element or Value but is positioned on a TopLevel" ) },
285
291
},
286
292
{
287
293
"slice/success" ,
0 commit comments