Skip to content

Commit

Permalink
Remove the non-beneficial runtime error
Browse files Browse the repository at this point in the history
  • Loading branch information
nachtjasmin committed Nov 22, 2023
1 parent 3d9d4e1 commit 6b2837c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
8 changes: 0 additions & 8 deletions errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,3 @@ type InvalidEntrypointError struct{ Entrypoint string }
func (e InvalidEntrypointError) Error() string {
return fmt.Sprintf("entrypoint %q does not exist", e.Entrypoint)
}

// EntrypointRuntimeError is a generic error for everything that happens during runtime.
type EntrypointRuntimeError struct{ inner error }

func (e EntrypointRuntimeError) Error() string {
return fmt.Sprintf("e5e unexpected runtime error: %s", e.inner.Error())
}
func (e EntrypointRuntimeError) Unwrap() error { return e.inner }
4 changes: 2 additions & 2 deletions mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (m *Mux) Start(ctx context.Context, args []string) error {
if m.Options == nil {
opts, err := parseArguments(args)
if err != nil {
return EntrypointRuntimeError{err}
return fmt.Errorf("go-e5e: parsing arguments failed: %w", err)
}

m.Options = &opts
Expand Down Expand Up @@ -144,7 +144,7 @@ func (m *Mux) Start(ctx context.Context, args []string) error {
for line := range lineChan {
response, err := m.execute(ctx, line)
if err != nil {
return EntrypointRuntimeError{err}
return fmt.Errorf("go-e5e: handler execution: %w", err)
}

_, _ = fmt.Fprint(m.Stdout, m.Options.StdoutExecutionSequence)
Expand Down

0 comments on commit 6b2837c

Please sign in to comment.