From 2e286e4a6d4f87f00b4f7d228dce140b2985de3c Mon Sep 17 00:00:00 2001
From: Nicolas Dumazet <nicolas.dumazet@nexedi.com>
Date: Thu, 11 Nov 2010 02:11:44 +0000
Subject: [PATCH] improve error messages

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40201 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Type/dynamic/portal_type_class.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/product/ERP5Type/dynamic/portal_type_class.py b/product/ERP5Type/dynamic/portal_type_class.py
index c75f846157..92308c9451 100644
--- a/product/ERP5Type/dynamic/portal_type_class.py
+++ b/product/ERP5Type/dynamic/portal_type_class.py
@@ -129,11 +129,16 @@ def generatePortalTypeClass(portal_type_name):
     mixin_list = []
     interface_list = []
 
-  type_class_path = document_class_registry.get(type_class)
-  if type_class_path is None:
+  if type_class is None:
     raise AttributeError('Document class is not defined on Portal Type %s' \
             % portal_type_name)
 
+  type_class_path = document_class_registry.get(type_class)
+  if type_class_path is None:
+    raise AttributeError('Document class %s has not been registered:' \
+                         ' cannot import it as base of Portal Type %s' \
+                         % (type_class, portal_type_name))
+
   klass = _importClass(type_class_path)
 
   ## Disabled because there will be no commit of
-- 
2.30.9