graph/education: slightly improve error handling and logging
- Use var for common errors - Add the addition error message to the Error() output of errorcode.Error - in PatchEducationSchool() use errorcode.RenderError() to turn the errorcode in to the right HTTP Status (instead of return 500 always)
This commit is contained in:
committed by
Ralf Haferkamp
parent
4f59de9c52
commit
a34d467285
@@ -130,7 +130,11 @@ func (e ErrorCode) String() string {
|
||||
}
|
||||
|
||||
func (e Error) Error() string {
|
||||
return errorCodes[e.errorCode]
|
||||
errString := errorCodes[e.errorCode]
|
||||
if e.msg != "" {
|
||||
errString += ": " + e.msg
|
||||
}
|
||||
return errString
|
||||
}
|
||||
|
||||
// RenderError render the Graph Error based on a code or default one
|
||||
|
||||
Reference in New Issue
Block a user