Skip to content

Commit 3ed7922

Browse files
committed
Revert "Fixed #187 - display line number for "Invalid line" error"
This reverts commit b14bb7d.
1 parent 881dc5c commit 3ed7922

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/attributecode/model.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -927,9 +927,13 @@ def hydrate(self, fields, use_mapping=False, mapping_file=None):
927927
try:
928928
setattr(self, name, custom_field)
929929
except:
930-
# According to https://stackoverflow.com/questions/533048/how-to-log-source-file-name-and-line-number-in-python/44401529 ,
931-
# we use `lineno` instead of `line` to get the line number
932-
msg = u'Invalid line: %(lineno)d: %(orig_name)r' % locals()
930+
# The intended captured error message should display
931+
# the line number of where the invalid line is,
932+
# but I am not able to get the line number from
933+
# the original code. By-passing the line number
934+
# for now.
935+
# msg = u'Invalid line: %(line)d: %(orig_name)r'
936+
msg = u'Invalid line: %(orig_name)r: ' % locals()
933937
msg += u'%s' % custom_field.value
934938
errors.append(Error(CRITICAL, msg))
935939
return errors

0 commit comments

Comments
 (0)