sync: Give the type of non-implemented flag type

This commit is contained in:
nemunaire 2023-11-05 12:25:46 +01:00
parent c70eb7f582
commit df90c5c72f

View File

@ -5,6 +5,7 @@ import (
_ "crypto/sha1" _ "crypto/sha1"
"encoding/hex" "encoding/hex"
"errors" "errors"
"fmt"
"hash" "hash"
"io" "io"
"os" "os"
@ -330,7 +331,7 @@ func (f *EFile) AddDepend(j Flag) (err error) {
} else if m, ok := j.(*MCQ); ok { } else if m, ok := j.(*MCQ); ok {
_, err = DBExec("INSERT INTO exercice_files_omcq_deps (id_file, id_mcq) VALUES (?, ?)", f.Id, m.Id) _, err = DBExec("INSERT INTO exercice_files_omcq_deps (id_file, id_mcq) VALUES (?, ?)", f.Id, m.Id)
} else { } else {
err = errors.New("dependancy type not implemented for this file") err = fmt.Errorf("dependancy type for flag (%T) not implemented for this file", j)
} }
return return
} }
@ -342,7 +343,7 @@ func (f *EFile) DeleteDepend(j Flag) (err error) {
} else if m, ok := j.(*MCQ); ok { } else if m, ok := j.(*MCQ); ok {
_, err = DBExec("DELETE FROM exercice_files_omcq_deps WHERE id_file = ? AND id_mcq = ?", f.Id, m.Id) _, err = DBExec("DELETE FROM exercice_files_omcq_deps WHERE id_file = ? AND id_mcq = ?", f.Id, m.Id)
} else { } else {
err = errors.New("dependancy type not implemented for this file") err = fmt.Errorf("dependancy type for flag (%T) not implemented for this file", j)
} }
return return
} }