Python : Handle situations in which FASI is unable to access to a group chat;
SVG : Add Xabber; TOML : Add Xabber and update several descriptions; XHTML : Update note for Haiku.
This commit is contained in:
parent
40ad9bd58d
commit
644842ab6d
4 changed files with 1278 additions and 31 deletions
26
fasi.py
26
fasi.py
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from asyncio import TimeoutError
|
||||
from datetime import datetime
|
||||
from email.utils import parseaddr
|
||||
from fastapi import FastAPI, Form, HTTPException, Request, Response
|
||||
|
@ -681,6 +682,12 @@ class HttpInstance:
|
|||
title = 'Internal Server Error'
|
||||
return result_get(request, action, title)
|
||||
|
||||
@self.app.exception_handler(504)
|
||||
def time_out_exception_handler(request: Request, exc: HTTPException):
|
||||
action = 'Warning'
|
||||
title = 'Time Out'
|
||||
return result_get(request, action, title)
|
||||
|
||||
def result_get(request: Request, action: str, title: str):
|
||||
template_file = 'result.xhtml'
|
||||
template_dict = {
|
||||
|
@ -850,12 +857,17 @@ class FileUtilities:
|
|||
node_title = jid_info['condition']
|
||||
node_note = jid_info['text']
|
||||
services = services_sorted = None
|
||||
elif isinstance(room_info_muc, IqTimeout):
|
||||
elif isinstance(room_info_muc['iq'], TimeoutError):
|
||||
action = 'Warning'
|
||||
node_title = 'Timeout'
|
||||
node_note = 'Request timeout has reached'
|
||||
services = services_sorted = None
|
||||
elif isinstance(room_info_muc['iq'], IqTimeout):
|
||||
action = 'Warning'
|
||||
node_title = 'Timeout'
|
||||
node_note = 'Timeout error'
|
||||
services = services_sorted = None
|
||||
elif isinstance(room_info_muc, IqError):
|
||||
elif isinstance(room_info_muc['iq'], IqError):
|
||||
action = 'Warning'
|
||||
breakpoint()
|
||||
node_title = room_info_muc['condition']
|
||||
|
@ -1366,11 +1378,17 @@ class XmppXep0045:
|
|||
#presence_options = {"pfrom" : jid_from},
|
||||
#seconds=seconds,
|
||||
#since=since,
|
||||
#timeout=30
|
||||
timeout=5
|
||||
)
|
||||
except TimeoutError as e:
|
||||
#raise HTTPException(status_code=504, detail='request-timeout-reached')
|
||||
error = True
|
||||
iq = e
|
||||
condition = 'Request timeout reached'
|
||||
text = str(e)
|
||||
except (IqError, IqTimeout, PresenceError) as e:
|
||||
error = True
|
||||
iq = None
|
||||
iq = e
|
||||
condition = e.iq['error']['condition']
|
||||
text = e.iq['error']['text']
|
||||
result = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue