Improve serialization error handling.
This commit is contained in:
parent
1fd63b8783
commit
5ed7cf2b1c
8 changed files with 81 additions and 39 deletions
|
|
@ -96,6 +96,9 @@ func isSimpleOperand(expression expression) bool {
|
|||
}
|
||||
|
||||
func (c *binaryExpression) serialize(statement statementType, out *queryData) error {
|
||||
if c == nil {
|
||||
return errors.New("Binary expression is nil.")
|
||||
}
|
||||
if c.lhs == nil {
|
||||
return errors.Newf("nil lhs.")
|
||||
}
|
||||
|
|
@ -142,6 +145,10 @@ func newPrefixExpression(expression expression, operator string) prefixExpressio
|
|||
}
|
||||
|
||||
func (p *prefixExpression) serialize(statement statementType, out *queryData) error {
|
||||
if p == nil {
|
||||
return errors.New("Prefix expression is nil.")
|
||||
}
|
||||
|
||||
out.writeString(p.operator + " ")
|
||||
|
||||
if p.expression == nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue