Created
March 10, 2014 05:41
-
-
Save theophoric/9460036 to your computer and use it in GitHub Desktop.
testing errors
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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