Skip to content

Error handler interface is too restricted  #52

Closed
@aaokunev

Description

@aaokunev

Hello! Right now you have type errorHandler:
type errorHandler func(w http.ResponseWriter, r *http.Request, err string)
i think, it seems too restricted, because type of err is string, instead of error. In case of type error, interface will be more Go-ideomatic. And in the client error handler it will be possible to operate with types, not strings:

err, ok := error.(MySuperError)
if ok == true {
	//do something with this error
}

instead:

if err == "Hey man! I'am Your Super Error! How are you? Are you missing?" {
	//do something
}

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions