forked from shaba/openuds
fixed error shown to user
This commit is contained in:
parent
1d807784d2
commit
099a9ba3c1
@ -79,12 +79,14 @@ class Client(Handler):
|
||||
"""
|
||||
result = result if result is not None else ''
|
||||
res = {'result': result}
|
||||
if error is not None:
|
||||
if error:
|
||||
if isinstance(error, int):
|
||||
error = errors.errorString(error)
|
||||
error = str(error) # Ensure error is an string
|
||||
if errorCode != 0:
|
||||
error += ' (code {0:04X})'.format(errorCode)
|
||||
# Reformat error so it is better understood by users
|
||||
# error += ' (code {0:04X})'.format(errorCode)
|
||||
error = _('Your service is being created. Please, wait while we complete it.)') + '({}%)'.format(int(errorCode * 25))
|
||||
|
||||
res['error'] = error
|
||||
res['retryable'] = '1' if retryable else '0'
|
||||
|
@ -127,7 +127,8 @@ def userServiceEnabler(request: 'HttpRequest', idService: str, idTransport: str)
|
||||
except ServiceNotReadyError as e:
|
||||
logger.debug('Service not ready')
|
||||
# Not ready, show message and return to this page in a while
|
||||
error += ' (code {0:04X})'.format(e.code)
|
||||
# error += ' (code {0:04X})'.format(e.code)
|
||||
error = _('Your service is being created, please, wait for a few seconds while we complete it.)') + '({}%)'.format(int(e.code * 25))
|
||||
except MaxServicesReachedError:
|
||||
logger.info('Number of service reached MAX for service pool "%s"', idService)
|
||||
error = errors.errorString(errors.MAX_SERVICES_REACHED)
|
||||
|
Loading…
x
Reference in New Issue
Block a user