Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
eta
gajim
Commits
3b08d054
Commit
3b08d054
authored
18 years ago
by
Liorithiel
Browse files
Options
Downloads
Patches
Plain Diff
Error handling when receiving commands.
parent
c1f211b2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/adhoc_commands.py
+22
-8
22 additions, 8 deletions
src/adhoc_commands.py
with
22 additions
and
8 deletions
src/adhoc_commands.py
+
22
−
8
View file @
3b08d054
...
...
@@ -313,7 +313,7 @@ class CommandWindow:
self
.
data_form_widget
.
data_form
=
self
.
dataform
except
dataforms
.
BadDataFormNode
:
# TODO: translate
self
.
stage5
(
'
Service sent malformed data
'
,
senderror
=
True
)
self
.
stage5
(
error
=
'
Service sent malformed data
'
,
senderror
=
True
)
self
.
data_form_widget
.
show
()
else
:
self
.
data_form_widget
.
hide
()
...
...
@@ -376,13 +376,26 @@ class CommandWindow:
self
.
stage1
()
# stage 5: an error has occured
def
stage5
(
self
,
error
,
senderror
=
False
):
def
stage5
(
self
,
error
=
None
,
errorid
=
None
,
senderror
=
False
):
'''
Display the error message. Wait for user to close the window
'''
# TODO: sending error to responder
# close old stage
self
.
stage_finish
()
assert
isinstance
(
error
,
basestring
)
assert
errorid
is
not
None
or
error
is
not
None
if
errorid
is
not
None
:
# we've got error code, display appropriate message
errorname
=
xmpp
.
NS_STANZAS
+
'
'
+
str
(
errorid
)
errordesc
=
xmpp
.
ERRORS
[
errorname
][
2
]
error
=
errordesc
.
decode
(
'
utf-8
'
)
del
errorname
,
errordesc
elif
error
is
not
None
:
# we've got error message
pass
else
:
# we don't know what's that, bailing out
assert
False
self
.
stages_notebook
.
set_current_page
(
self
.
stages_notebook
.
page_num
(
...
...
@@ -435,9 +448,7 @@ class CommandWindow:
error
=
response
.
getError
()
if
error
is
not
None
:
# extracting error description from xmpp/protocol.py
errorname
=
xmpp
.
NS_STANZAS
+
'
'
+
str
(
error
)
errordesc
=
xmpp
.
ERRORS
[
errorname
][
2
]
self
.
stage5
(
errordesc
.
decode
(
'
utf-8
'
))
self
.
stage5
(
errorid
=
error
)
return
# no commands => no commands stage
...
...
@@ -472,9 +483,12 @@ class CommandWindow:
cmdnode
.
addChild
(
node
=
dataforms
.
DataForm
(
tofill
=
self
.
data_form_widget
.
data_form
))
def
callback
(
response
):
# TODO: error handling
# TODO: move to connection_handlers.py
self
.
stage3_next_form
(
response
.
getTag
(
'
command
'
))
err
=
response
.
getError
()
if
err
is
not
None
:
self
.
stage5
(
errorid
=
err
)
else
:
self
.
stage3_next_form
(
response
.
getTag
(
'
command
'
))
print
stanza
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment