Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

proposal: implement Error interface for error types #328

Open

Description

building upon #127, can we add an Error method to error types so that in our sdk's we can directly return the error instead of having to map it to error msgs manually.

e.g. following method in the sdk could be just removed if we had that.

func errorVariantToError(err abc.Error) error {
	switch {
	case abc.ErrorInputNotSupported() == err:
		return fmt.Errorf("input not supported")
	case abc.RuntimeError() == err:
		return fmt.Errorf("runtime error")
	case abc.InvalidInput() == err:
		return fmt.Errorf("invalid input")
	default:
		return fmt.Errorf("no error provided by host implementation")
	}
}

Another thing we could possibly do is to replace "-" with " " automatically (to make it more readable), but its just a nice to have item.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /