         missingMethodMatch = @methodRegex.exec codeSnippet
         target = missingMethodMatch[1] if missingMethodMatch?
       hint = if target? then @getNoFunctionHint target
-    else if missingReference = msg.match /([^\s]+) is not defined/
+    else if missingReference = message.match /([^\s]+) is not defined/
       hint = @getReferenceErrorHint missingReference[1]
-    else if missingProperty = msg.match /Cannot (?:read|call) (?:property|method) '([\w]+)' of (?:undefined|null)/
+    else if missingProperty = message.match /Cannot (?:read|call) (?:property|method) '([\w]+)' of (?:undefined|null)/
       # Chrome: "Cannot read property 'moveUp' of undefined"
       # TODO: Firefox: "tmp5 is undefined"
       hint = @getReferenceErrorHint missingProperty[1]

      else new RegExp "this\\.(\\w+)\\("
    @context = context ? {}

  getHint: (msg, code, range) ->
    return unless @context?
    if (missingMethodMatch = msg.match(/has no method '(.*?)'/)) or msg.match(/is not a function/) or msg.match(/has no method/)
      # NOTE: We only get this for valid thisValue and parens: self.blahblah()
      # NOTE: We get different error messages for this based on javascript engine:
      # Chrome: 'undefined is not a function'

  # Use problemContext to add hints
  return unless context?
  hintCreator = new HintCreator context, languageID
  hintCreator.getHint code, options

class HintCreator
  # Create hints for an error message based on a problem context
