fix: Raise PageDoesNotExistError instead of DoesNotExistError (#12485)
- to avoid it getting mixed up with Document Not Found error
This commit is contained in:
parent
91176153a2
commit
71dd300ae3
3 changed files with 6 additions and 3 deletions
|
|
@ -33,6 +33,9 @@ class PermissionError(Exception):
|
|||
class DoesNotExistError(ValidationError):
|
||||
http_status_code = 404
|
||||
|
||||
class PageDoesNotExistError(ValidationError):
|
||||
http_status_code = 404
|
||||
|
||||
class NameError(Exception):
|
||||
http_status_code = 409
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ def render(path=None, http_status_code=None):
|
|||
else:
|
||||
try:
|
||||
data = render_page_by_language(path)
|
||||
except frappe.DoesNotExistError:
|
||||
except frappe.PageDoesNotExistError:
|
||||
doctype, name = get_doctype_from_path(path)
|
||||
if doctype and name:
|
||||
path = "printview"
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ def get_page_context(path):
|
|||
def make_page_context(path):
|
||||
context = resolve_route(path)
|
||||
if not context:
|
||||
raise frappe.DoesNotExistError
|
||||
raise frappe.PageDoesNotExistError
|
||||
|
||||
context.doctype = context.ref_doctype
|
||||
|
||||
|
|
@ -440,4 +440,4 @@ def get_doctypes_with_web_view():
|
|||
return frappe.cache().get_value('doctypes_with_web_view', _get)
|
||||
|
||||
def get_start_folders():
|
||||
return frappe.local.flags.web_pages_folders or ('www', 'templates/pages')
|
||||
return frappe.local.flags.web_pages_folders or ('www', 'templates/pages')
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue