From 85680cc93dde05f82ef0b3dcd8f3f029d79291d8 Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Wed, 2 Feb 2022 12:14:26 +0530 Subject: [PATCH] chore: better error message --- frappe/core/doctype/doctype/doctype.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frappe/core/doctype/doctype/doctype.py b/frappe/core/doctype/doctype/doctype.py index a439458ec7..bf62ece69c 100644 --- a/frappe/core/doctype/doctype/doctype.py +++ b/frappe/core/doctype/doctype/doctype.py @@ -701,9 +701,10 @@ class DocType(Document): # a Doctype name is the tablename created in database # `tab` the length of tablename is limited to 64 characters - if len(name) > (frappe.db.MAX_COLUMN_LENGTH - 3): + max_length = frappe.db.MAX_COLUMN_LENGTH - 3 + if len(name) > max_length: # length(tab + ) should be equal to 64 characters hence doctype should be 61 characters - frappe.throw(_("Doctype name is limited to 61 characters ({0})").format(name)) + frappe.throw(_("Doctype name is limited to {0} characters ({1})").format(max_length, name)) flags = {"flags": re.ASCII}