Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'ERR' object has no attribute 'message' #481

Open
will-moore opened this issue Jun 22, 2023 · 3 comments · May be fixed by #534
Open

AttributeError: 'ERR' object has no attribute 'message' #481

will-moore opened this issue Jun 22, 2023 · 3 comments · May be fixed by #534

Comments

@will-moore
Copy link
Member

https://www.openmicroscopy.org/qa2/qa/feedback/33051/

Traceback (most recent call last):

File "/omero/venv3/lib64/python3.6/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)

File "/omero/venv3/lib64/python3.6/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/omero/venv3/lib64/python3.6/site-packages/omeroweb/decorators.py", line 544, in wrapped
retval = f(request, *args, **kwargs)

File "/omero/venv3/lib64/python3.6/site-packages/omeroweb/decorators.py", line 603, in wrapper
context = f(request, *args, **kwargs)

File "/omero/venv3/lib64/python3.6/site-packages/omeroweb/webclient/views.py", line 3555, in activities
rv = graphResponseMarshal(conn, rsp)

File "/omero/venv3/lib64/python3.6/site-packages/omeroweb/webgateway/marshal.py", line 448, in graphResponseMarshal
rv["error"] = rsp.message

AttributeError: 'ERR' object has no attribute 'message'
@will-moore
Copy link
Member Author

Reported again at https://www.openmicroscopy.org/qa2/qa/feedback/33756/

The graphResponseMarshal() is only used for dry-run chgrp and chown jobs and this error is only created if there's an error: if isinstance(rsp, omero.cmd.ERR):

Might be tricky to reproduce... but should be easy to fix that and not try to access rsp.message.

@will-moore
Copy link
Member Author

Same error when handling error with group update permissions
https://www.openmicroscopy.org/qa2/qa/feedback/41346/

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/opt/omero/web/venv3/lib/python3.8/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)

File "/opt/omero/web/venv3/lib/python3.8/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/opt/omero/web/venv3/lib/python3.8/site-packages/omeroweb/decorators.py", line 538, in wrapped
retval = f(request, *args, **kwargs)

File "/opt/omero/web/venv3/lib/python3.8/site-packages/omeroweb/decorators.py", line 597, in wrapper
context = f(request, *args, **kwargs)

File "/opt/omero/web/venv3/lib/python3.8/site-packages/omeroweb/webadmin/views.py", line 867, in manage_group
msgs = conn.updateGroup(group, name, perm, description)

File "/opt/omero/web/venv3/lib/python3.8/site-packages/omeroweb/webclient/webclient_gateway.py", line 1504, in updateGroup
err = self.updatePermissions(group, permissions)

File "/opt/omero/web/venv3/lib/python3.8/site-packages/omeroweb/webclient/webclient_gateway.py", line 1594, in updatePermissions
message = ex.err.message

AttributeError: 'ERR' object has no attribute 'message'

@will-moore
Copy link
Member Author

Checking what attributes should be used to get strings from these error objects...

>>> from omero import CmdError
>>> CmdError.__file__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: type object 'CmdError' has no attribute '__file__'
>>> c = CmdError()
>>> c = CmdError("badness")
>>> str(c)
'\nbadness'
>>> c.message
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'CmdError' object has no attribute 'message'
>>> c.err
'badness'

>>> import omero
>>> from omero import cmd
>>> e = cmd.ERR("some error")
>>> e.message
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'ERR' object has no attribute 'message'
>>> str(e)
'object #0 (::omero::cmd::ERR)\n{\n    category = shit\n    name = \n    parameters = {}\n}'
>>> e.category
'some error'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant