Add proper error handling when the config volume is mounted in a read-only state.
This commit is contained in:
parent
bcd8a48159
commit
036c8e56e0
3 changed files with 23 additions and 3 deletions
|
@ -4,6 +4,7 @@ import json
|
|||
from flask import make_response
|
||||
from app import app
|
||||
from util.useremails import CannotSendEmailException
|
||||
from util.config.provider import CannotWriteConfigException
|
||||
from data import model
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -17,3 +18,11 @@ def handle_dme(ex):
|
|||
def handle_emailexception(ex):
|
||||
message = 'Could not send email. Please contact an administrator and report this problem.'
|
||||
return make_response(json.dumps({'message': message}), 400)
|
||||
|
||||
@app.errorhandler(CannotWriteConfigException)
|
||||
def handle_configexception(ex):
|
||||
message = ('Configuration could not be written to the mounted volume. \n' +
|
||||
'Please make sure the mounted volume is not read-only and restart ' +
|
||||
'the setup process. \n\nIssue: %s' % ex)
|
||||
|
||||
return make_response(json.dumps({'message': message}), 400)
|
Reference in a new issue