Skip to content

Commit 58cfa35

Browse files
committed
[FIX] Fix error handling
1 parent 7d5a9cd commit 58cfa35

File tree

3 files changed

+28
-11
lines changed

3 files changed

+28
-11
lines changed

soql/parser/postprocess/normalize3.go

+23-8
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,15 @@ func (ctx *normalizeQueryContext) applyColIndexToFields(q *SoqlQuery, fields []S
5151
}
5252
}
5353
case SoqlFieldInfo_Function:
54-
ctx.applyColIndexToFields(q, fields[i].Parameters)
54+
if err := ctx.applyColIndexToFields(q, fields[i].Parameters); err != nil {
55+
return err
56+
}
5557
}
5658
}
5759
return nil
5860
}
5961

60-
func (ctx *normalizeQueryContext) applyColIndexToConditions(q *SoqlQuery, conditions []SoqlCondition) {
62+
func (ctx *normalizeQueryContext) applyColIndexToConditions(q *SoqlQuery, conditions []SoqlCondition) error {
6163
for i := range conditions {
6264
if conditions[i].Opcode == SoqlConditionOpcode_FieldInfo {
6365
switch conditions[i].Value.Type {
@@ -68,10 +70,13 @@ func (ctx *normalizeQueryContext) applyColIndexToConditions(q *SoqlQuery, condit
6870
conditions[i].Value.ColIndex = -1
6971
}
7072
case SoqlFieldInfo_Function:
71-
ctx.applyColIndexToFields(q, conditions[i].Value.Parameters)
73+
if err := ctx.applyColIndexToFields(q, conditions[i].Value.Parameters); err != nil {
74+
return err
75+
}
7276
}
7377
}
7478
}
79+
return nil
7580
}
7681

7782
func (ctx *normalizeQueryContext) applyColIndexToOrders(orderBy []SoqlOrderByInfo) {
@@ -84,15 +89,25 @@ func (ctx *normalizeQueryContext) applyColIndexToOrders(orderBy []SoqlOrderByInf
8489
}
8590
}
8691

87-
func (ctx *normalizeQueryContext) applyColIndex(q *SoqlQuery) {
92+
func (ctx *normalizeQueryContext) applyColIndex(q *SoqlQuery) error {
8893

89-
ctx.applyColIndexToFields(q, q.Fields)
94+
if err := ctx.applyColIndexToFields(q, q.Fields); err != nil {
95+
return err
96+
}
9097

9198
ctx.applyColIndexToOrders(q.OrderBy)
9299

93-
ctx.applyColIndexToFields(q, q.GroupBy)
100+
if err := ctx.applyColIndexToFields(q, q.GroupBy); err != nil {
101+
return err
102+
}
94103

95-
ctx.applyColIndexToConditions(q, q.Where)
104+
if err := ctx.applyColIndexToConditions(q, q.Where); err != nil {
105+
return err
106+
}
107+
108+
if err := ctx.applyColIndexToConditions(q, q.Having); err != nil {
109+
return err
110+
}
96111

97-
ctx.applyColIndexToConditions(q, q.Having)
112+
return nil
98113
}

soql/parser/postprocess/normalizeperobj.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ CHECK_FIELDS:
8888
}
8989
}
9090
if !hasConditionsOriginally {
91+
// TODO:
9192
innerJoined = true
9293
}
9394

@@ -336,7 +337,9 @@ func (ctx *normalizeQueryContext) buildPerObjectInfo(q *SoqlQuery) error {
336337
}
337338
}
338339

339-
ctx.applyColIndex(q)
340+
if err := ctx.applyColIndex(q); err != nil {
341+
return err
342+
}
340343

341344
for i := 0; i < len(q.From); i++ {
342345
perObjQuery := q.From[i].PerObjectQuery

web/index.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ <h4 class="title"><img
9393
and
9494
LEN(con.Name) > 0
9595
GROUP BY
96-
acc.Id
97-
, acc.Name
96+
acc.Name
9897
, con.Name
9998
, xid
10099
, foo__r.bar__r.zzz

0 commit comments

Comments
 (0)