Better error reporting for Formula Script errors

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jamie
    Senior Member
    • Aug 2025
    • 348

    #1

    Better error reporting for Formula Script errors

    This just doesn't cut it.

    PHP Code:
    [2026-09-28 10:38:23] CRITICAL: (0) Before-save formula script failed. Function assign; Bad argument type at position 2, must be string. :: POST /Formula/action/run
    [object] (Espo\ORM\Exceptions\PersistenceException(code: 0): Before-save formula script failed. at /var/www/html/application/Espo/Hooks/Common/Formula.php:88)
    [previous exception] [object] (Espo\Core\Formula\Exceptions\Error(code: 500): Function assign; Bad argument type at position 2, must be string. at /var/www/html/application/Espo/Core/Formula/Processor.php:114) 
    

    What file? What line in that file? What second argument is bad?

    No, I've got to spend hours testing each line in the file i think it is, maybe i am right, maybe I am wrong. There is NO WAY to know.

    i am glad to see Espo modernizing with Docker, but such obtuse, opaque error messages just aren't any use. We need to know the actual file and the actual line number; otherwise, you might as well just say

    error -> an error has happened

    and that is no help to anyone but that is what the error above says
    Last edited by yuri; Today, 11:48 AM.
  • yuri
    EspoCRM product developer
    • Mar 2014
    • 10059

    #2
    The topic name should mention "formula script"? E.g. "Better log reporting for Formula Script errors".

    The current error log reporting is fine. It prints file and line number, as well as trace. Absolutely no problem to track down where an error occurred, if it's a PHP-level error.

    You might deal with a formula script level error. But there's no concept of "file" in formula script, it's a misleading detail.

    ---


    I changed the topic name. Please try to use better topic names the next time.
    Last edited by yuri; Today, 11:49 AM.

    Comment


    • jamie
      jamie commented
      Editing a comment
      this isn't a PHP error " Before-save formula script failed. Function assign; Bad argument type at position 2, must be string." That's a formula script error or at least i think it is, could be a JavaScript error for the amount of information it gives

      or maybe you mean this PHP error?
      Before-save formula script failed. at /var/www/html/application/Espo/Hooks/Common/Formula.php:88

      yeah could be line 88... yeah let me just hack that for a bit see whats happening.... <3 hours later> o wait thats the PHP that handels forula... maybe it might be a problem with the formula... if only i knew what formula or what line...

      i just need better error reporting, and yeah, identifying where abouts the error is located is part of that, as this is on a before save; I believe that to be a file.

      But either way, it needs to show the line number and a way to locate whatever script is involved

      You're welcome to adjust the titles to what you think is better to get the task done.

      This kind of error when i am trying to upgrade our system to espo10 is utterly useless
  • jamie
    Senior Member
    • Aug 2025
    • 348

    #3
    do we think that better error reporting will be an upcoming feature?

    Comment

    Working...