Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
cloudooo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
cloudooo
Commits
87001ce3
Commit
87001ce3
authored
Apr 22, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wsgixmlrpcapplication,manager: log errors
Log tracebacks on error
parent
ebeac211
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
12 deletions
+23
-12
cloudooo/manager.py
cloudooo/manager.py
+5
-9
cloudooo/wsgixmlrpcapplication.py
cloudooo/wsgixmlrpcapplication.py
+18
-3
No files found.
cloudooo/manager.py
View file @
87001ce3
...
...
@@ -275,8 +275,7 @@ class Manager(object):
del
response_dict
[
'meta'
][
'Data'
]
return
(
200
,
response_dict
,
""
)
except
Exception
as
e
:
import
traceback
;
logger
.
error
(
traceback
.
format_exc
())
logger
.
error
(
'Error converting to %s'
,
extension
,
exc_info
=
True
)
return
(
402
,
{},
e
.
args
[
0
])
def
run_setmetadata
(
self
,
filename
=
''
,
data
=
None
,
meta
=
None
,
...
...
@@ -292,8 +291,7 @@ class Manager(object):
response_dict
[
'data'
]
=
self
.
updateFileMetadata
(
data
,
extension
,
meta
)
return
(
200
,
response_dict
,
''
)
except
Exception
as
e
:
import
traceback
;
logger
.
error
(
traceback
.
format_exc
())
logger
.
error
(
'Error setting metadata'
,
exc_info
=
True
)
return
(
402
,
{},
e
.
args
[
0
])
def
run_getmetadata
(
self
,
filename
=
''
,
data
=
None
,
meta
=
None
,
...
...
@@ -312,8 +310,7 @@ class Manager(object):
response_dict
[
'meta'
][
'title'
]
=
response_dict
[
'meta'
][
'Title'
]
return
(
200
,
response_dict
,
''
)
except
Exception
as
e
:
import
traceback
;
logger
.
error
(
'run_getmetadata: '
+
traceback
.
format_exc
())
logger
.
error
(
'Error getting metadata'
,
exc_info
=
True
)
return
(
402
,
{},
e
.
args
[
0
])
def
run_generate
(
self
,
filename
=
''
,
data
=
None
,
meta
=
None
,
extension
=
None
,
...
...
@@ -354,8 +351,7 @@ class Manager(object):
mimetypes
.
types_map
.
get
(
'.%s'
%
extension
.
split
(
'.'
)[
-
1
]))
return
(
200
,
response_dict
,
""
)
except
Exception
as
e
:
import
traceback
;
logger
.
error
(
traceback
.
format_exc
())
logger
.
error
(
'Error in generate from %s to %s'
,
orig_format
,
extension
,
exc_info
=
True
)
return
(
402
,
response_dict
,
str
(
e
))
def
getAllowedTargetItemList
(
self
,
content_type
):
...
...
@@ -374,7 +370,7 @@ class Manager(object):
response_dict
[
'response_data'
]
=
extension_list
return
(
200
,
response_dict
,
''
)
except
Exception
as
e
:
logger
.
error
(
e
)
logger
.
error
(
'Error in getting target item list from %s'
,
content_type
,
exc_info
=
Tru
e
)
return
(
402
,
{},
e
.
args
[
0
])
def
_getOOGranulator
(
self
,
data
,
source_format
=
"odt"
):
...
...
cloudooo/wsgixmlrpcapplication.py
View file @
87001ce3
...
...
@@ -12,16 +12,30 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import
logging
from
SimpleXMLRPCServer
import
SimpleXMLRPCDispatcher
logger
=
logging
.
getLogger
(
__name__
)
class
WSGIXMLRPCApplication
(
object
):
class
ErrorLoggingXMLRPCDispatcher
(
SimpleXMLRPCDispatcher
):
"""A XMLRPC Dispatcher which logs errors
"""
def
_dispatch
(
self
,
method
,
params
):
try
:
return
SimpleXMLRPCDispatcher
.
_dispatch
(
self
,
method
,
params
)
except
:
logger
.
exception
(
"Error calling %s"
,
method
)
raise
class
WSGIXMLRPCApplication
:
"""Application to handle requests to the XMLRPC service"""
def
__init__
(
self
,
instance
=
None
,
methods
=
[]):
"""Create windmill xmlrpc dispatcher"""
self
.
dispatcher
=
SimpleXMLRPCDispatcher
(
allow_none
=
True
,
encoding
=
None
)
self
.
dispatcher
=
ErrorLoggingXMLRPCDispatcher
(
allow_none
=
True
,
encoding
=
None
)
if
instance
is
not
None
:
self
.
dispatcher
.
register_instance
(
instance
)
for
method
in
methods
:
...
...
@@ -63,6 +77,7 @@ class WSGIXMLRPCApplication(object):
response
+=
'
\
n
'
except
:
# This should only happen if the module is buggy
# internal error, report as HTTP server error
logger
.
exception
(
"Error serving request"
)
start_response
(
"500 Server error"
,
[(
'Content-Type'
,
'text/plain'
)])
return
[]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment