Feature Request - More friendly error logs
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 6.5k
- Forks
- 787
- PR merge metrics
- No merged PRs in 30d
Description
SUMMARY
Sometimes figuring out what an error in a log file means takes more work than just fixing the problem that caused the error. It would be nice to be able to have more-friendly errors being output.
ISSUE TYPE
Pick one below and delete the rest:
- Feature Idea
STACKSTORM VERSION
st2 2.10.1, on Python 2.7.5
OS / ENVIRONMENT / INSTALL METHOD
centos7 both docker and bare metal. rpm install.
STEPS TO REPRODUCE
In my latest scenario, a misplaced yaql function wasn't being evaluated.
My webhook jinja looked like:
action:
ref: "ostk_dbsa.modify_db_connection_limits"
parameters:
database: "{{ trigger.body.database.lower() | default('postgres') }}"
when it should have been this:
action:
ref: "ostk_dbsa.modify_db_connection_limits"
parameters:
database: "{{ trigger.body.database | default('postgres') | lower() }}"
EXPECTED RESULTS
less cryptic output?
ACTUAL RESULTS
2019-03-20 09:37:13,225 139865561968304 DEBUG param [-] Failed to render database: 'mongoengine.base.datastructures.BaseDict
object' has no attribute 'database'
Traceback (most recent call last):
File "/opt/stackstorm/st2/lib/python2.7/site-packages/st2common/util/param.py", line 210, in _resolve_dependencies
context[name] = _render(node, context)
File "/opt/stackstorm/st2/lib/python2.7/site-packages/st2common/util/param.py", line 189, in _render
result = ENV.from_string(str(node['template'])).render(render_context)
File "/opt/stackstorm/st2/lib/python2.7/site-packages/jinja2/environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "/opt/stackstorm/st2/lib/python2.7/site-packages/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "<template>", line 1, in top-level template code
File "/opt/stackstorm/st2/lib/python2.7/site-packages/jinja2/environment.py", line 430, in getattr
return getattr(obj, attribute)
UndefinedError: 'mongoengine.base.datastructures.BaseDict object' has no attribute 'database'
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with st2common/util/param.py, especially _resolve_dependencies and _render, and reproduce the webhook template example from the issue. Define what friendlier output should communicate for the invalid attribute or filter usage, then verify the resulting log explains the failure more clearly than the current traceback.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100