Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug with error handling for Thing update SQL #1408

Closed
orangetcy opened this issue Apr 16, 2021 · 1 comment · Fixed by #1409
Closed

Bug with error handling for Thing update SQL #1408

orangetcy opened this issue Apr 16, 2021 · 1 comment · Fixed by #1409

Comments

@orangetcy
Copy link
Contributor

BUG REPORT

there is a very little code bug in things sql update function. In mainflux/things/postgres/things.go line:99 - 101
error handle with res.RowsAffected, it should be errdb not err

ENHANCEMENT
from

        cnt, errdb := res.RowsAffected()
	if err != nil {
		return errors.Wrap(things.ErrUpdateEntity, errdb)
	}

to

        cnt, errdb := res.RowsAffected()
	if errdb != nil {
		return errors.Wrap(things.ErrUpdateEntity, errdb)
	}
@dborovcanin dborovcanin changed the title code bug with thing update sql error handle Bug with error handling for Thing update SQL Apr 16, 2021
@dborovcanin
Copy link
Collaborator

dborovcanin commented Apr 16, 2021

@orangetcy I can confirm the bug. Since this is rather a simple fix and the solution you proposed will do the job, do you want to issue a fix pull request and join the Mainflux contributors team?

orangetcy pushed a commit to orangetcy/mainflux that referenced this issue Apr 19, 2021
orangetcy pushed a commit to orangetcy/mainflux that referenced this issue Apr 20, 2021
Signed-off-by: Chengyou Tang <tcy277813009@gmail.com>
drasko pushed a commit that referenced this issue Apr 20, 2021
Signed-off-by: Chengyou Tang <tcy277813009@gmail.com>

Co-authored-by: Chengyou Tang <tcy277813009@gmail.com>
Co-authored-by: Dušan Borovčanin <dusan.borovcanin@mainflux.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants