Move error reporting to its own package.
This commit is contained in:
parent
d7c5a19f85
commit
0641c47109
1 changed files with 9 additions and 4 deletions
|
|
@ -1,8 +1,10 @@
|
||||||
package runner
|
package errors
|
||||||
|
|
||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
func emitError(line int, message string) {
|
var hadError = false
|
||||||
|
|
||||||
|
func EmitError(line int, message string) {
|
||||||
report(line, "", message)
|
report(line, "", message)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -13,6 +15,9 @@ func report(line int, where, message string) {
|
||||||
where,
|
where,
|
||||||
message,
|
message,
|
||||||
)
|
)
|
||||||
// TODO: The book sets `hadError` as true here, need to figure out where
|
hadError = true
|
||||||
// that's used.
|
}
|
||||||
|
|
||||||
|
func HadError() bool {
|
||||||
|
return hadError
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue