mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
uniformed the error for duplicate key
This commit is contained in:
@@ -879,6 +879,9 @@ func (self *SQLStorage) SetCDR(cdr *CDR, allowUpdate bool) error {
|
||||
if saved.Error != nil {
|
||||
tx.Rollback()
|
||||
if !allowUpdate {
|
||||
if strings.Contains(saved.Error.Error(), "1062") || strings.Contains(saved.Error.Error(), "duplicate key") { // returns 1062/pq when key is duplicated
|
||||
return utils.ErrExists
|
||||
}
|
||||
return saved.Error
|
||||
}
|
||||
tx = self.db.Begin()
|
||||
|
||||
Reference in New Issue
Block a user