mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-13 22:49:51 -04:00
Add time to missing null check error messages
This commit is contained in:
parent
afff1056cb
commit
81d6c186dc
1 changed files with 11 additions and 1 deletions
|
@ -35,7 +35,17 @@ module.exports = class ProblemAlertView extends CocoView
|
|||
context = super context
|
||||
if @problem?
|
||||
format = (s) -> marked(s.replace(/</g, '<').replace(/>/g, '>')) if s?
|
||||
context.message = format @problem.aetherProblem.message
|
||||
message = @problem.aetherProblem.message
|
||||
# Add time to problem message if hint is for a missing null check
|
||||
# NOTE: This may need to be updated with Aether error hint changes
|
||||
if @problem.aetherProblem.hint? and /(?:null|undefined)/.test @problem.aetherProblem.hint
|
||||
age = @problem.aetherProblem.userInfo?.age
|
||||
if age?
|
||||
if /^Line \d+:/.test message
|
||||
message = message.replace /^(Line \d+)/, "$1, time #{age.toFixed(1)}"
|
||||
else
|
||||
message = "Time #{age.toFixed(1)}: #{message}"
|
||||
context.message = format message
|
||||
context.hint = format @problem.aetherProblem.hint
|
||||
context
|
||||
|
||||
|
|
Loading…
Reference in a new issue