             status = 'Error'
             title = 'Unknown Error (' + proc.exitCode + '); Check your Dev Console and ~/.wakatime.log for more info.'
 
-          console.warn msg
+          if msg?
+            console.warn msg
           statusBarTileView?.setStatus(status)
           statusBarTileView?.setTitle(title)
 

        unloadHandler = null
  )

setupEventHandlers = () ->
  atom.workspace.observeTextEditors (editor) =>
    try
      buffer = editor.getBuffer()

    @statusBarTile?.destroy()
    statusBarTileView?.destroy()
    @settingChangedObserver?.dispose()

finishActivation = () ->
  pluginReady = true
  setupEventHandlers()
  statusBarTileView?.setTitle('WakaTime ready')
  statusBarTileView?.setStatus()
  
settingChangedHandler = (settings) ->
  if settings.showStatusBarIcon
    statusBarTileView?.show()
  else
    statusBarTileView?.hide()
  apiKey = settings.apikey
  if isValidApiKey(apiKey)
    atom.config.set 'wakatime.apikey', '' # clear setting so it updates in UI
    atom.config.set 'wakatime.apikey', 'Saved in your ~/.wakatime.cfg file'
    saveApiKey apiKey

saveApiKey = (apiKey) ->
  configFile = path.join getUserHome(), '.wakatime.cfg'
