chore: changed logging for actionRun to be user friendly#4076
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough
Changes
Poem
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
companion/lib/Instance/Connection/ChildHandlerNew.ts (1)
408-411: Nice approach filtering for Error instances! Small thought on the message formatting 💭The
instanceof Errorcheck is a good call for cleaner user-facing logs. One tiny thing: sincee.messageis already a string, wrapping it instringifyError()might be unnecessary. That said, ifstringifyErrordoes any additional sanitization you want, feel free to keep it!♻️ Optional simplification
if (e instanceof Error) { - this.#sendToModuleLog('error', `Error executing action: ${stringifyError(e.message)}`) + this.#sendToModuleLog('error', `Error executing action: ${e.message}`) }
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0c28ad17-52c7-45c3-9e03-2a65971abcc1
📒 Files selected for processing (1)
companion/lib/Instance/Connection/ChildHandlerNew.ts
Currently with Companion API v2 and using an Expression on an action option the error shown to the user in their logs is somewhat generic and includes a stack trace that is not particularly useful to non-devs, such as:
This PR hopes to improve on this by leaving the stack trace in the main Companion logger for debugging, but the message sent to the module log that will be seen by the users in the Companion WebUI will include the name of the action, the location, and the option errors.
Or if it happens in an Action that's on a Trigger instead of a Button
This PR doesn't touch the error when an Expression is invalid when given by the Learn functionality on an action, partly because a lot of the values needed aren't currently provided to that function, but also because if the Learn function is providing invalid values then it's an issue for the module developer rather than the end user.
Summary by CodeRabbit