repochecker: fix numerous general issues with exception inheritance

This commit is contained in:
nemunaire 2022-11-03 17:49:06 +01:00
parent 057ce22fb9
commit f9e9bfcb75
4 changed files with 15 additions and 4 deletions

View file

@ -85,7 +85,7 @@ func buildExerciceHints(i Importer, exercice *fic.Exercice, exceptions *CheckExc
} else {
// Call checks hooks
for _, hk := range hooks.mdTextHooks {
for _, err := range hk(h.Content, exceptions.GetFileExceptions("challenge.txt")) {
for _, err := range hk(h.Content, exceptions) {
errs = append(errs, NewHintError(exercice, h, n, err))
}
}
@ -97,7 +97,7 @@ func buildExerciceHints(i Importer, exercice *fic.Exercice, exceptions *CheckExc
// Call checks hooks
for _, hook := range hooks.hintHooks {
for _, e := range hook(h, exceptions.GetFileExceptions("challenge.txt")) {
for _, e := range hook(h, exceptions) {
errs = append(errs, NewHintError(exercice, h, n, e))
}
}
@ -120,6 +120,8 @@ func buildExerciceHints(i Importer, exercice *fic.Exercice, exceptions *CheckExc
// CheckExerciceHints checks if all hints are corrects..
func CheckExerciceHints(i Importer, exercice *fic.Exercice, exceptions *CheckExceptions) ([]importHint, []error) {
exceptions = exceptions.GetFileExceptions("challenge.txt")
return buildExerciceHints(i, exercice, exceptions)
}
@ -128,6 +130,8 @@ func SyncExerciceHints(i Importer, exercice *fic.Exercice, flagsBindings map[int
if _, err := exercice.WipeHints(); err != nil {
errs = append(errs, err)
} else {
exceptions = exceptions.GetFileExceptions("challenge.txt")
hints, berrs := buildExerciceHints(i, exercice, exceptions)
errs = append(errs, berrs...)