Do not panic if Begin().Error was ignored
This commit is contained in:
		
							parent
							
								
									52c5c8127c
								
							
						
					
					
						commit
						3d28ad4718
					
				
							
								
								
									
										3
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								main.go
									
									
									
									
									
								
							@ -491,7 +491,8 @@ func (s *DB) Begin() *DB {
 | 
			
		||||
 | 
			
		||||
// Commit commit a transaction
 | 
			
		||||
func (s *DB) Commit() *DB {
 | 
			
		||||
	if db, ok := s.db.(sqlTx); ok && db != nil {
 | 
			
		||||
	var emptySQLTx *sql.Tx
 | 
			
		||||
	if db, ok := s.db.(sqlTx); ok && db != nil && db != emptySQLTx {
 | 
			
		||||
		s.AddError(db.Commit())
 | 
			
		||||
	} else {
 | 
			
		||||
		s.AddError(ErrInvalidTransaction)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user