Skip to content

Add AddOptionWithValidation interface to support error reporting in service options #2378

@Umang01-hash

Description

@Umang01-hash

Is your feature request related to a problem? Please describe.
Our current service.Options interface doesn't support error reporting. This creates a risk of silent failures when invalid configurations are used as options.

package service

type Options interface {
	AddOption(h HTTP) HTTP
}

When using AddOption, validation errors cannot be surfaced to the caller. Consumers must use separate validation methods or constructors, creating a disconnected validation flow.

Describe the solution you'd like

Create a new interface AddOptionWithValidation that returns an error:

type AddOptionWithValidation interface {
    AddOptionWithValidation(h HTTP) (HTTP, error)
}

Services can check for this interface before falling back to the standard Options interface, enabling proper error handling while maintaining backward compatibility.

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageThe issue needs triaging.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions