Skip to content

Commit 0df7f31

Browse files
committed
migrate to SDK v0.5.0: typed Result return for Handle
Updates echo to the new module.Handler / Component.Handle signature returning module.Result. The chained handler() call already returns Result via the new typed Handler and passes through unchanged. No behavior changes — purely the typed-return migration.
1 parent da825d6 commit 0df7f31

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

components/echo/echo.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ func (t *Component) GetInfo() module.ComponentInfo {
3636
}
3737
}
3838

39-
func (t *Component) Handle(ctx context.Context, handler module.Handler, port string, msg interface{}) any {
39+
func (t *Component) Handle(ctx context.Context, handler module.Handler, port string, msg interface{}) module.Result {
4040
if in, ok := msg.(InMessage); ok {
4141
return handler(ctx, OutPort, in.Context)
4242
}
43-
return fmt.Errorf("invalid message")
43+
return module.Fail(fmt.Errorf("invalid message"))
4444
}
4545

4646
func (t *Component) Ports() []module.Port {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ require (
88
github.com/rs/zerolog v1.34.0
99
github.com/spf13/cobra v1.10.2
1010
github.com/spf13/viper v1.20.1
11-
github.com/tiny-systems/module v0.2.0
11+
github.com/tiny-systems/module v0.5.0
1212
)
1313

1414
require (

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,8 @@ github.com/tiny-systems/ajson v0.1.6 h1:Ch7E4Oerx4mHse+wbCdb1ZYuVATLuH76g2RWHC+B
423423
github.com/tiny-systems/ajson v0.1.6/go.mod h1:a1M1W+3VQu6yNLxOwtKRq+y58Hy/oFWMkQBE/aKhVBs=
424424
github.com/tiny-systems/errorpanic v0.7.1 h1:GgbimfhC2wnQ8012SGGxh743ryaJXSSD7boLK+IQ0Xs=
425425
github.com/tiny-systems/errorpanic v0.7.1/go.mod h1:AQobicdSB/J3RzN81pTG4dqgcULaEIrEOvNC8TpSgxw=
426-
github.com/tiny-systems/module v0.2.0 h1:8hwHefXgtQGW4rYg0kbgvqRFbC9OXXZfWVDiQrVon8I=
427-
github.com/tiny-systems/module v0.2.0/go.mod h1:dsuKa7EUGkkEEYfc11RlENDw1p8oXLedhkz9I0qR8sw=
426+
github.com/tiny-systems/module v0.5.0 h1:fOf8VGvu/OoVs2feK75VPg1aprlBlFosQcDPTNzUXxk=
427+
github.com/tiny-systems/module v0.5.0/go.mod h1:dsuKa7EUGkkEEYfc11RlENDw1p8oXLedhkz9I0qR8sw=
428428
github.com/tiny-systems/otel-collector v0.5.1 h1:tylLj7f7O7n5o9R383Lojd0fN7j5jgZ76zFshJ0SE6c=
429429
github.com/tiny-systems/otel-collector v0.5.1/go.mod h1:EGo1dQ3+5iG3ejGJ8y9kMgHhOGB6WyoasJDUHesKXEA=
430430
github.com/tiny-systems/platform-api v0.5.0 h1:3pPr1MjMGYwbrXtUG9mZvA6aXTvyQdHrgM3UAzpUQkw=

0 commit comments

Comments
 (0)