Use fmt.Errorf
This commit is contained in:
parent
45069d4fbb
commit
adb424ea03
11 changed files with 50 additions and 60 deletions
|
@ -1,7 +1,6 @@
|
|||
package fic
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"path"
|
||||
"strings"
|
||||
|
@ -12,18 +11,18 @@ var HintCoefficient = 1.0
|
|||
|
||||
// EHint represents a challenge hint.
|
||||
type EHint struct {
|
||||
Id int64 `json:"id"`
|
||||
Id int64 `json:"id"`
|
||||
// IdExercice is the identifier of the underlying challenge
|
||||
IdExercice int64 `json:"idExercice"`
|
||||
IdExercice int64 `json:"idExercice"`
|
||||
// Title is the hint name displayed to players
|
||||
Title string `json:"title"`
|
||||
Title string `json:"title"`
|
||||
// Content is the actual content of small text hints (mutually exclusive with File field)
|
||||
// When File is filled, Content contains the hexadecimal file's hash.
|
||||
Content string `json:"content"`
|
||||
Content string `json:"content"`
|
||||
// File is path, relative to FilesDir where the file hint is stored (mutually exclusive with Content field)
|
||||
File string `json:"file"`
|
||||
File string `json:"file"`
|
||||
// Cost is the amount of points the player will loose if it unlocks the hint
|
||||
Cost int64 `json:"cost"`
|
||||
Cost int64 `json:"cost"`
|
||||
}
|
||||
|
||||
// treatHintContent reads Content to detect if this is a hint file in order to convert to such hint.
|
||||
|
@ -138,7 +137,7 @@ func (h EHint) AddDepend(f Flag) (err error) {
|
|||
} else if d, ok := f.(MCQ); ok {
|
||||
_, err = DBExec("INSERT INTO exercice_hints_omcq_deps (id_hint, id_mcq_dep) VALUES (?, ?)", h.Id, d.Id)
|
||||
} else {
|
||||
err = errors.New(fmt.Sprintf("Dependancy type for key (%T) not implemented for this flag.", f))
|
||||
err = fmt.Errorf("Dependancy type for key (%T) not implemented for this flag.", f)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
Reference in a new issue