Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

ambiguous exception needs to be more specific #8

@jjmanzer

Description

@jjmanzer

Describe the bug
When an assignment_group is provided to create_change_request() that is invalid, we get an unclear message back leaving the user (and dev) unsure of what to do.

To Reproduce
Steps to reproduce the behavior:

change_order = ChangeRequestHandler().create_change_request(
    co_title,
    co_description,
    assignment_group="bad_assignment_group",
    payload=payload
)

Expected behavior
A clear and concise message like "your assignment_group XXX does not exist".

Additional context
Exception text

Traceback (most recent call last):
File "/usr/local/share/thor_api/.venv/lib/python3.6/site-packages/pysnow/response.py", line 173, in one
result = next(r)
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/share/thor_api/.venv/lib/python3.6/site-packages/celery/app/trace.py", line 382, in trace_task
R = retval = fun(*args, **kwargs)
File "/usr/local/share/thor_api/.venv/lib/python3.6/site-packages/newrelic/hooks/application_celery.py", line 85, in wrapper
return wrapped(*args, **kwargs)
File "/usr/local/share/thor_api/.venv/lib/python3.6/site-packages/celery/app/trace.py", line 641, in __protected_call__
return self.run(*args, **kwargs)
File "/usr/local/share/thor_api/netexec/tasks.py", line 59, in execute_request
request_handler.run()
File "/usr/local/share/thor_api/netexec/handlers/base.py", line 58, in run
if self.create_automated_change_order():
File "/usr/local/share/thor_api/netexec/handlers/base.py", line 109, in create_automated_change_order
payload=payload
File "/usr/local/share/thor_api/.venv/lib/python3.6/site-packages/django_snow/helpers/snow_request_handler.py", line 47, in create_change_request
payload['assignment_group'] = self.get_snow_group_guid(assignment_group or self.snow_assignment_group)
File "/usr/local/share/thor_api/.venv/lib/python3.6/site-packages/django_snow/helpers/snow_request_handler.py", line 147, in get_snow_group_guid
result = response.one()
File "/usr/local/share/thor_api/.venv/lib/python3.6/site-packages/pysnow/response.py", line 175, in one
raise NoResults("No records found")
pysnow.exceptions.NoResults: No records found

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions