Skip to content

mapOperator missing res when return error in "map" function #406

@feng7208485

Description

@feng7208485

here is my code

func main() {
	supplier := make([]rxgo.Producer, 0)
	supplier = append(supplier, GenCheckFieldTypeFuture(context.Background(), AAA{Foo: "111"}))
	observable := rxgo.Create(supplier).Map(func(_ context.Context, i interface{}) (interface{}, error) {
		if v, ok := i.(CheckFieldTypeParam); ok {
			println(fmt.Sprintf("v type is : %v", reflect.TypeOf(v)))
			return v, errors.New("asasfqwfq")
		}
		return i, nil
	}, rxgo.WithPool(1))

	for item := range observable.Observe() {
		println(fmt.Sprintf("item.V type is:%v", reflect.TypeOf(item.V)))
		println(fmt.Sprintf("item.E type is:%v", reflect.TypeOf(item.E)))
	}
}

the out put is

v type is : main.CheckFieldTypeParam
item.V type is:<nil>
item.E type is:*errors.errorString

Expected behavior
I expect item.V is not nil, the framwork should not drop result even if the map fun return an error!!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions