mirror of
https://github.com/powerline/powerline.git
synced 2025-07-23 05:46:01 +02:00
Raise TypeError only if it is segment type that has problems
It raised TypeError also when module did not have required function
This commit is contained in:
parent
06d4b4555f
commit
7d668de169
@ -30,9 +30,10 @@ class Segments(object):
|
|||||||
def get(self, segment, side):
|
def get(self, segment, side):
|
||||||
segment_type = segment.get('type', 'function')
|
segment_type = segment.get('type', 'function')
|
||||||
try:
|
try:
|
||||||
contents, contents_func, key = getattr(self, 'get_{0}'.format(segment_type))(segment)
|
get_segment_info = getattr(self, 'get_{0}'.format(segment_type))
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
raise TypeError('Unknown segment type: {0}'.format(segment_type))
|
raise TypeError('Unknown segment type: {0}'.format(segment_type))
|
||||||
|
contents, contents_func, key = get_segment_info(segment)
|
||||||
highlighting_group = segment.get('highlight', segment.get('name'))
|
highlighting_group = segment.get('highlight', segment.get('name'))
|
||||||
return {
|
return {
|
||||||
'key': key,
|
'key': key,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user