@ai-matrx/records-ui 0.116.45 → 0.116.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/helpers.js CHANGED
@@ -1049,23 +1049,25 @@ function exampleOf(error) {
1049
1049
  const example = detail.example;
1050
1050
  return typeof example === "string" && example.trim() !== "" ? example.trim() : null;
1051
1051
  }
1052
+ var TIMED_OUT_SAID = "This took too long. Please try again.";
1052
1053
  function refusalForAPerson(error) {
1053
1054
  const code = error.code ?? "internal";
1055
+ const timedOut = code === "timed_out" || error.sqlstate === "57014" || /canceling statement due to statement timeout/i.test(String(error.message ?? ""));
1054
1056
  const ours = error.ours === true;
1055
1057
  const hint = plainSentence(String(error.hint ?? ""));
1056
1058
  const message = ours ? plainSentence(String(error.message ?? "")) : peopleSentence(String(error.message ?? ""));
1057
- const title = TITLE[code] ?? "That was refused";
1059
+ const title = timedOut ? TITLE["timed_out"] : TITLE[code] ?? "That was refused";
1058
1060
  const hintIsForEngineers = isDeveloperHint(String(error.hint ?? ""));
1059
1061
  const example = exampleOf(error);
1060
- const remedy = (example ? `Enter it like ${example}.` : null) ?? (hintIsForEngineers ? null : hint.kept) ?? REMEDY[code] ?? REMEDY["internal"];
1062
+ const remedy = (example ? `Enter it like ${example}.` : null) ?? (hintIsForEngineers ? null : hint.kept) ?? (timedOut ? REMEDY["timed_out"] : REMEDY[code]) ?? REMEDY["internal"];
1061
1063
  const messageIsForEngineers = isEngineerText(String(error.message ?? ""));
1062
- const said = (messageIsForEngineers ? "" : message.kept ?? "").trim();
1064
+ const said = timedOut ? TIMED_OUT_SAID : (messageIsForEngineers ? "" : message.kept ?? "").trim();
1063
1065
  const forEngineers = [
1064
1066
  error.sqlstate ? `SQLSTATE ${error.sqlstate}.` : null,
1065
1067
  // The client's own note about a class it did not recognize, or a call that
1066
1068
  // never reached the store. It is rendered out of sight, never as a sentence.
1067
1069
  error.diagnostic ? error.diagnostic : null,
1068
- messageIsForEngineers ? `Message: ${error.message}` : null,
1070
+ messageIsForEngineers || timedOut ? `Message: ${error.message}` : null,
1069
1071
  error.hint && (hintIsForEngineers || hint.kept !== error.hint) ? `Hint: ${error.hint}` : null,
1070
1072
  message.dropped.length > 0 || hint.dropped.length > 0 ? `Dropped from the person's view: ${[...message.dropped, ...hint.dropped].join(" | ")}` : null
1071
1073
  ].filter(Boolean).join(" ");