Files
codeql/ql/test/experimental/InconsistentCode/GORMErrorNotChecked.qhelp
Sauyon Lee 1ffeb26a61 Add query for a GORM error not checked
co-authored-by: Sam Partington <sampart@github.com>
co-authored-by: Robin Neatherway <rneatherway@github.com>
2021-08-11 18:15:23 -07:00

36 lines
766 B
XML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>
<overview>
<p>GORM errors are returned as a field of the return value instead of a separate return value.</p>
<p>It is therefore very easy to miss that an error may occur and omit error handling routines.</p>
</overview>
<recommendation>
<p>Ensure that GORM errors are checked.</p>
</recommendation>
<example>
<p>In the example below, </p>
<sample src="MissingErrorCheck.go" />
<p>The corrected version of <code>user</code> checks <code>err</code> before using <code>ptr</code>.</p>
<sample src="MissingErrorCheckGood.go" />
</example>
<references>
<li>
The Go Blog:
<a href="https://blog.golang.org/error-handling-and-go">Error handling and Go</a>.
</li>
</references>
</qhelp>