Permalink
Browse files

New: Only include scenario in error messages when using multiple scen…

…arios.

This will make messages more reable.
  • Loading branch information...
1 parent dde4745 commit 4ff38b7e1dbede189c2c2daae232a87198100f5c @scrapper scrapper committed Jun 23, 2013
Showing with 12 additions and 2 deletions.
  1. +8 −2 lib/taskjuggler/MessageHandler.rb
  2. +4 −0 lib/taskjuggler/TjpSyntaxRules.rb
@@ -136,6 +136,8 @@ def reset
@logLevel = 3
# The full file name of the log file.
@logFile = nil
+ # Toggle if scenario ids are included in the messages or not.
+ @hideScenario = true
# The name of the current application
@appName = 'unknown'
# Set to true if program should be exited on warnings.
@@ -168,7 +170,6 @@ def clear
@messages = []
end
-
# Set the console output level.
def outputLevel=(level)
@outputLevel = checkLevel(level)
@@ -179,6 +180,10 @@ def logLevel=(level)
@logLevel = checkLevel(level)
end
+ def hideScenario=(yesNo)
+ @hideScenario = yesNo
+ end
+
# Generate a fatal message that will abort the application.
def fatal(id, message, sourceFileInfo = nil, line = nil, data = nil,
scenario = nil)
@@ -268,7 +273,8 @@ def addMessage(type, id, message, sourceFileInfo = nil, line = nil,
# Treat criticals like errors but without generating another
# exception.
msg = Message.new(type == :critical ? :error : type, id, message,
- sourceFileInfo, line, data, scenario)
+ sourceFileInfo, line, data,
+ @hideScenario ? nil : scenario)
@messages << msg
# Append the message to the log file if requested by the user.
@@ -5126,6 +5126,10 @@ def rule_scenarioHeader
end
@property = Scenario.new(@project, @val[1], @val[2], @property)
@property.inheritAttributes
+
+ if @project.scenarios.length > 1
+ MessageHandlerInstance.instance.hideScenario = false
+ end
})
arg(1, 'id', 'The ID of the scenario')
arg(2, 'name', 'The name of the scenario')

0 comments on commit 4ff38b7

Please sign in to comment.