add: an exercise to error handling

This commit is contained in:
Inanc Gumus
2019-05-17 11:14:54 +03:00
parent 99860abef8
commit 5c1364e181
4 changed files with 74 additions and 1 deletions

View File

@@ -14,7 +14,8 @@ import (
"os"
)
// Detect returns only the valid filenames that match to a header of the given format.
// Detect returns the files that have a valid header (file signature).
// A valid header is determined by the format.
func Detect(format string, filenames []string) (valids []string, err error) {
defer func() {
if rerr := recover(); rerr != nil {