Skip to content

Commit 97a32a7

Browse files
Merge 25.7 to 25.9
2 parents 254d1a3 + ffa0fe6 commit 97a32a7

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

LDK/src/org/labkey/ldk/query/LookupValidationHelper.java

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,33 +193,43 @@ public void cascadeUpdate(String targetSchema, String targetTable, String target
193193
qus.updateRows(_user, _container, toUpdate, oldPKs, null, new HashMap<>());
194194
}
195195

196-
public boolean verifyNotUsed(String targetSchema, String targetTable, String targetField, Object val) throws SQLException
196+
public boolean verifyNotUsed(String targetSchema, String targetTable, String targetField, Object val, String triggerScriptName) throws SQLException
197197
{
198-
return verifyNotUsed(targetSchema, targetTable, targetField, val, null);
198+
return verifyNotUsed(targetSchema, targetTable, targetField, val, null, triggerScriptName);
199199
}
200200

201-
public boolean verifyNotUsed(String targetSchema, String targetTable, String targetField, Object val, @Nullable String containerPath) throws SQLException
201+
public boolean verifyNotUsed(String targetSchema, String targetTable, String targetField, Object val, @Nullable String containerPath, String triggerScriptName) throws SQLException
202202
{
203203
Container c = _container;
204204
if (containerPath != null)
205205
{
206206
c = ContainerManager.getForPath(containerPath);
207207
if (c == null)
208208
{
209-
throw new IllegalArgumentException("Unknown container: " + containerPath);
209+
_log.error("Error running '" + triggerScriptName + "' trigger script. Container '{}' not found", containerPath);
210+
return false;
210211
}
211212
}
212213

213214
UserSchema us = QueryService.get().getUserSchema(_user, c, targetSchema);
214215
if (us == null)
215-
throw new IllegalArgumentException("Unknown schema: " + targetSchema);
216+
{
217+
_log.error("Error running '" + triggerScriptName + "' trigger script. Schema '{}' not found in container '{}'", targetSchema, c.getName());
218+
return false;
219+
}
216220

217221
TableInfo ti = us.getTable(targetTable);
218222
if (ti == null)
219-
throw new IllegalArgumentException("Unknown table: " + targetTable);
223+
{
224+
_log.error("Error running '" + triggerScriptName + "' trigger script. Table '{}' not found in container '{}'", targetTable, c.getName());
225+
return false;
226+
}
220227

221228
if (ti.getColumn(targetField) == null)
222-
throw new IllegalArgumentException("Unknown column: " + targetField + " in table: " + targetTable);
229+
{
230+
_log.error("Error running '" + triggerScriptName + "' trigger script. Column '{}' not found in table '{}'", targetField, targetTable);
231+
return false;
232+
}
223233

224234
TableSelector ts = new TableSelector(ti, new SimpleFilter(FieldKey.fromString(targetField), val), null);
225235

0 commit comments

Comments
 (0)