Skip to content

Instantly share code, notes, and snippets.

@theophoric
Created March 10, 2014 05:41
Show Gist options
  • Save theophoric/9460036 to your computer and use it in GitHub Desktop.
Save theophoric/9460036 to your computer and use it in GitHub Desktop.
testing errors
package main
import (
"errors"
"fmt"
)
type HttpError struct {
code int
error
}
func main() {
testErrors()
}
func testErrors() (err error) {
err = errors.New("new error")
if err != nil {
fmt.Println(err)
hErr := HttpError{
code: 201,
error: err,
}
fmt.Println(hErr)
err = hErr
fmt.Println(err)
fmt.Println(err == hErr)
}
return
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment