mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 06:40:54 +03:00
normalize common database errors
Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -105,6 +105,9 @@ func getRespStatus(err error) int {
|
||||
if errors.Is(err, plugin.ErrNoSearcher) || errors.Is(err, dataprovider.ErrNotImplemented) {
|
||||
return http.StatusNotImplemented
|
||||
}
|
||||
if errors.Is(err, dataprovider.ErrDuplicatedKey) || errors.Is(err, dataprovider.ErrForeignKeyViolated) {
|
||||
return http.StatusConflict
|
||||
}
|
||||
return http.StatusInternalServerError
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user