mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
This interface allows it to create rich codersdk errors and pass them up to the `wsbuilder` error handling.
20 lines
308 B
Go
20 lines
308 B
Go
package httperror
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/coder/coder/v2/codersdk"
|
|
)
|
|
|
|
type Responder interface {
|
|
Response() (int, codersdk.Response)
|
|
}
|
|
|
|
func IsResponder(err error) (Responder, bool) {
|
|
var responseErr Responder
|
|
if errors.As(err, &responseErr) {
|
|
return responseErr, true
|
|
}
|
|
return nil, false
|
|
}
|