Last active
August 13, 2018 07:06
-
-
Save pulkitkumar/f47b32237905725c33591409056bdf1f to your computer and use it in GitHub Desktop.
Simple error handling
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
n, err := io.ReadAtLeast(r, buf, min) | |
if err != nil { | |
switch err { | |
case io.ErrShortBuffer: | |
// handle short buffer error | |
break | |
case io.ErrUnexpectedEOF: | |
// handle short buffer error | |
break | |
default: | |
// handle other errors | |
} | |
} | |
// use n .. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment