Save user code errors without 'Line N: ' prefix

This commit is contained in:
Matt Lott 2014-10-24 14:05:51 -07:00
parent 42b81fd55e
commit f4426f2e43
3 changed files with 9 additions and 1 deletions

View file

@ -15,6 +15,7 @@ _.extend UserCodeProblemSchema.properties,
errId: {type: 'string'}
errLevel: {type: 'string'}
errMessage: {type: 'string'}
errMessageNoLineInfo: {type: 'string'}
errRange: {type: 'array'}
errType: {type: 'string'}
language: {type: 'string'}

View file

@ -539,7 +539,13 @@ module.exports = class SpellView extends CocoView
@userCodeProblem.set 'errHint', aetherProblem.hint if aetherProblem.hint
@userCodeProblem.set 'errId', aetherProblem.id if aetherProblem.id
@userCodeProblem.set 'errLevel', aetherProblem.level if aetherProblem.level
@userCodeProblem.set 'errMessage', aetherProblem.message if aetherProblem.message
if aetherProblem.message
@userCodeProblem.set 'errMessage', aetherProblem.message
# Save error message without 'Line N: ' prefix
messageNoLineInfo = aetherProblem.message
if lineInfoMatch = messageNoLineInfo.match /^Line [0-9]+\: /
messageNoLineInfo = messageNoLineInfo.slice(lineInfoMatch[0].length)
@userCodeProblem.set 'errMessageNoLineInfo', messageNoLineInfo
@userCodeProblem.set 'errRange', aetherProblem.range if aetherProblem.range
@userCodeProblem.set 'errType', aetherProblem.type if aetherProblem.type
@userCodeProblem.set 'language', aether.language.id if aether.language?.id

View file

@ -11,6 +11,7 @@ class UserCodeProblemHandler extends Handler
'errId'
'errLevel'
'errMessage'
'errMessageNoLineInfo'
'errRange'
'errType'
'language'