From ca91ce2d856f79d6cc1cb2d67ed0daef2a89b377 Mon Sep 17 00:00:00 2001
From: Nigel Tao
// Error codes returned by failures to parse an expression.
var (
- ErrInternal = os.NewError("internal error")
- ErrUnmatchedLpar = os.NewError("unmatched '('")
- ErrUnmatchedRpar = os.NewError("unmatched ')'")
+ ErrInternal = os.NewError("regexp: internal error")
+ ErrUnmatchedLpar = os.NewError("regexp: unmatched '('")
+ ErrUnmatchedRpar = os.NewError("regexp: unmatched ')'")
...
)
@@ -2673,6 +2673,13 @@ it is much more informative than the plain
"no such file or directory".
+When feasible, error strings should identify their origin, such as by having +a prefix naming the package that generated the error. For example, in package +image, the string representation for a decoding error due to an unknown format +is "image: unknown format". +
+Callers that care about the precise error details can use a type switch or a type assertion to look for specific