Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

[itemloader-errors] added error message in get_value

Mabel Villalba8d1e0e09bb6f
diff --git a/scrapy/loader/__init__.py b/scrapy/loader/__init__.py
index 20f0f90c3..5055de015 100644
--- a/scrapy/loader/__init__.py
+++ b/scrapy/loader/__init__.py
@@ -106,11 +106,17 @@ class ItemLoader(object):
value = arg_to_iter(value)
value = flatten(extract_regex(regex, x) for x in value)
- for proc in processors:
+ for _proc in processors:
if value is None:
break
- proc = wrap_loader_context(proc, self.context)
- value = proc(value)
+ proc = wrap_loader_context(_proc, self.context)
+ try:
+ value = proc(value)
+ except Exception as e:
+ raise ValueError(
+ "Error with processor %s value=%r error='%s: %s'" %
+ (_proc.__class__.__name__, value, type(e).__name__,
+ str(e)))
return value
def load_item(self):