summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-03-21 18:56:50 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-03-21 23:38:07 +0900
commit98b0d6568cdb9527f7245f16c8674044797c5006 (patch)
tree0409613849de8ae820a87b1e5162a682f9e1db58
parentf9edceed17039df045677f7103c40f7dbadf2a5d (diff)
downloadbuildstream-98b0d6568cdb9527f7245f16c8674044797c5006.tar.gz
_message.py, _frontend/widget.py: Reviving MessageType.ERROR
We need to distinguish between: o Errors which occurred in a task, and are related to a log file and an elapsed time. o Errors which occurred in the main process and are not related to any timed activity
-rw-r--r--buildstream/_frontend/widget.py13
-rw-r--r--buildstream/_message.py4
2 files changed, 12 insertions, 5 deletions
diff --git a/buildstream/_frontend/widget.py b/buildstream/_frontend/widget.py
index b5f581556..044f2bebc 100644
--- a/buildstream/_frontend/widget.py
+++ b/buildstream/_frontend/widget.py
@@ -35,6 +35,10 @@ from .._message import MessageType
from ..plugin import _plugin_lookup
+# These messages are printed a bit differently
+ERROR_MESSAGES = [MessageType.FAIL, MessageType.ERROR, MessageType.BUG]
+
+
# Widget()
#
# Args:
@@ -164,6 +168,7 @@ class TypeName(Widget):
MessageType.START: "blue",
MessageType.SUCCESS: "green",
MessageType.FAIL: "red",
+ MessageType.ERROR: "red",
MessageType.BUG: "red",
}
@@ -244,7 +249,7 @@ class CacheKey(Widget):
if isinstance(plugin, Element):
_, key, missing = plugin._get_full_display_key()
- if message.message_type in [MessageType.FAIL, MessageType.BUG]:
+ if message.message_type in ERROR_MESSAGES:
text = self.err_profile.fmt(key)
else:
text = self.content_profile.fmt(key, dim=missing)
@@ -274,7 +279,7 @@ class LogFile(Widget):
if logfile.startswith(self.logdir) and abbrev:
logfile = logfile[len(self.logdir) + 1:]
- if message.message_type in [MessageType.FAIL, MessageType.BUG]:
+ if message.message_type in ERROR_MESSAGES:
text = self.err_profile.fmt(logfile)
else:
text = self.content_profile.fmt(logfile, dim=True)
@@ -400,7 +405,7 @@ class LogLine(Widget):
n_lines = len(lines)
abbrev = False
- if message.message_type not in [MessageType.FAIL, MessageType.BUG] \
+ if message.message_type not in ERROR_MESSAGES \
and not frontend_message and n_lines > self.message_lines:
abbrev = True
lines = lines[0:self.message_lines]
@@ -410,7 +415,7 @@ class LogLine(Widget):
detail = self.indent + self.indent.join(lines)
text += '\n'
- if message.message_type in [MessageType.FAIL, MessageType.BUG]:
+ if message.message_type in ERROR_MESSAGES:
text += self.err_profile.fmt(detail, bold=True)
else:
text += self.detail_profile.fmt(detail)
diff --git a/buildstream/_message.py b/buildstream/_message.py
index 73b93bdc8..9073e3803 100644
--- a/buildstream/_message.py
+++ b/buildstream/_message.py
@@ -29,8 +29,9 @@ class MessageType():
STATUS = "status" # Status message, verbose details
INFO = "info" # Informative messages
WARN = "warning" # Warning messages
- LOG = "log" # Messages for log files _only_, never in the frontend
+ ERROR = "error" # Error messages
BUG = "bug" # An unhandled exception was raised in a plugin
+ LOG = "log" # Messages for log files _only_, never in the frontend
# Timed Messages: SUCCESS and FAIL have duration timestamps
START = "start" # Status start message
@@ -44,6 +45,7 @@ unconditional_messages = [
MessageType.INFO,
MessageType.WARN,
MessageType.FAIL,
+ MessageType.ERROR,
MessageType.BUG
]