Throw error if there is no detect regex

Closes #712
This commit is contained in:
Zachary Yedidia
2017-06-22 10:42:06 -04:00
parent f27ee60149
commit 19926d95fe

View File

@@ -1,6 +1,7 @@
package highlight package highlight
import ( import (
"errors"
"fmt" "fmt"
"regexp" "regexp"
@@ -122,6 +123,10 @@ func ParseFtDetect(file *File) (r [2]*regexp.Regexp, err error) {
} }
} }
if loaded == 0 {
return r, errors.New("No detect regexes found")
}
return r, err return r, err
} }