invalid db error and value and invalid value length error (#4151)
This commit is contained in:
		
							parent
							
								
									a948c84607
								
							
						
					
					
						commit
						495ec4bd87
					
				| @ -1,7 +1,6 @@ | ||||
| package gorm | ||||
| 
 | ||||
| import ( | ||||
| 	"errors" | ||||
| 	"fmt" | ||||
| 	"reflect" | ||||
| 	"strings" | ||||
| @ -441,7 +440,7 @@ func (association *Association) saveAssociation(clear bool, values ...interface{ | ||||
| 				break | ||||
| 			} | ||||
| 
 | ||||
| 			association.Error = errors.New("invalid association values, length doesn't match") | ||||
| 			association.Error = ErrInvalidValueOfLength | ||||
| 			return | ||||
| 		} | ||||
| 
 | ||||
|  | ||||
| @ -104,7 +104,7 @@ func (p *processor) Execute(db *DB) { | ||||
| 			stmt.ReflectValue = stmt.ReflectValue.Elem() | ||||
| 		} | ||||
| 		if !stmt.ReflectValue.IsValid() { | ||||
| 			db.AddError(fmt.Errorf("invalid value")) | ||||
| 			db.AddError(ErrInvalidValue) | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
|  | ||||
| @ -31,4 +31,10 @@ var ( | ||||
| 	ErrEmptySlice = errors.New("empty slice found") | ||||
| 	// ErrDryRunModeUnsupported dry run mode unsupported
 | ||||
| 	ErrDryRunModeUnsupported = errors.New("dry run mode unsupported") | ||||
| 	// ErrInvaildDB invalid db
 | ||||
| 	ErrInvaildDB = errors.New("invalid db") | ||||
| 	// ErrInvalidValue invalid value
 | ||||
| 	ErrInvalidValue = errors.New("invalid value") | ||||
| 	// ErrInvalidValueOfLength invalid values do not match length
 | ||||
| 	ErrInvalidValueOfLength = errors.New("invalid association values, length doesn't match") | ||||
| ) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 heige
						heige