Sfoglia il codice sorgente

HUE-8888 [editor] Avoid 500 error when opening a non existing saved query

Romain 5 anni fa
parent
commit
12024633a2
1 ha cambiato i file con 4 aggiunte e 1 eliminazioni
  1. 4 1
      desktop/libs/notebook/src/notebook/decorators.py

+ 4 - 1
desktop/libs/notebook/src/notebook/decorators.py

@@ -53,7 +53,10 @@ def check_editor_access_permission():
         pass
       else:
         if editor_id:  # Open existing saved editor document
-          editor_type = _get_editor_type(editor_id)
+          try:
+            editor_type = _get_editor_type(editor_id)
+          except Document2.DoesNotExist:
+            raise PopupException(_('Query id %s can not be found, please open a new editor') % editor_id)
 
         if check_permissions(request.user, editor_type):
           raise PopupException(_('Missing permission to access the %s Editor' % editor_type), error_code=401)