Skip to content

Commit

Permalink
Change an error message slightly. Add a TODO. Change a bit of formatt…
Browse files Browse the repository at this point in the history
…ing too.
  • Loading branch information
CaspianA1 committed Jun 25, 2024
1 parent d048825 commit 58ce812
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions dbos-rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Also, some `bcrypt` functions generate random data and should only be called fro
// The keys are the ids, and the values are the messages themselves
return new Map([
["globalModification", "This is a global modification relative to the workflow declaration"],
["awaitingOnNotAllowedType", `This function (expected to be deterministic) should not await with a leftmost value of this type (allowed set: \{${validTypeSetString}\})`],
["awaitingOnNotAllowedType", `This function should not await with the current leftmost type (allowed set: \{${validTypeSetString}\})`],
["Date", makeDateMessage("`Date()` or `new Date()`")],
["Date.now", makeDateMessage("`Date.now()`")],
["Math.random", "Avoid calling `Math.random()` directly; it can lead to non-reproducible behavior. See `@dbos-inc/communicator-random`"],
Expand Down Expand Up @@ -199,7 +199,10 @@ const awaitsOnNotAllowedType: DetChecker = (node, _fn, _isLocal) => {

if (Node.isAwaitExpression(node)) {
const functionCall = node.getExpression();
if (!Node.isCallExpression(functionCall)) return; // Wouldn't make sense otherwise

if (!Node.isCallExpression(functionCall)) {
return; // Wouldn't make sense otherwise
}

let lhs = reduceNodeToLeftmostLeaf(functionCall);

Expand All @@ -214,7 +217,9 @@ const awaitsOnNotAllowedType: DetChecker = (node, _fn, _isLocal) => {

/* If the typename is undefined, there's no associated typename
(so possibly a variable is being used that was never defined;
that error will be handled elsewhere). */
that error will be handled elsewhere). TODO: figure out what's
happening when the Typescript compiler can't get type info out
of the LHS (that happens in some very rare cases). */
const typeName = getTypeNameForTsMorphNode(lhs);

if (typeName === undefined) {
Expand Down

0 comments on commit 58ce812

Please sign in to comment.