Class: Xcov::ErrorHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/xcov/error_handler.rb

Class Method Summary collapse

Class Method Details

.handle_error(output) ⇒ Object

This method should raise an exception in any case, as the return code indicated a failed build

Parameters:

  • The (String)

    output of the errored build



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/xcov/error_handler.rb', line 8

def handle_error(output)
  # The order of the handling below is import
  case output
  when /US\-ASCII/
    print "Your shell environment is not correctly configured"
    print "Instead of UTF-8 your shell uses US-ASCII"
    print "Please add the following to your '~/.bashrc':"
    print ""
    print "       export LANG=en_US.UTF-8"
    print "       export LANGUAGE=en_US.UTF-8"
    print "       export LC_ALL=en_US.UTF-8"
    print ""
    print "You'll have to restart your shell session after updating the file."
    print "If you are using zshell or another shell, make sure to edit the correct bash file."
    print "For more information visit this stackoverflow answer:"
    print "https://stackoverflow.com/a/17031697/445598"
  when /CoverageNotFound/
    print "Unable to find any .xccoverage file."
    print "Make sure you have enabled 'Gather code coverage' setting on your scheme settings."
    print "Alternatively you can provide the full path to your .xccoverage file."
  when /Executed/
    # this is *really* important:
    # we don't want to raise an exception here
    # as we handle this in runner.rb at a later point
    # after parsing the actual test results
    return
  end
  raise "Error processing coverage file - see the log above".red
end