Method: Exception#foorth_code

Defined in:
lib/fOOrth/monkey_patch/exceptions.rb

#foorth_codeObject

Retrieve the fOOrth exception code of this exception.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/fOOrth/monkey_patch/exceptions.rb', line 66

def foorth_code
  if /^[A-Z]\d\d(,\d\d)*:/ =~ self.message
    result = $MATCH
  else
    klass = self.class

    while (klass)
      break if (result = FOORTH_EXCEPTION_CODE[klass])
      klass = klass.superclass
    end
  end

  result ||= "E??:"
end