Exception: Rfm::Error::FileMakerError
- Defined in:
- lib/rfm_error.rb
Overview
Base class for all FileMaker errors
Direct Known Subclasses
ConcurrencyError, FileError, GeneralError, MissingError, SecurityError, SystemError, UnknownError, ValidationError
Constant Summary collapse
- @@default_messages =
Default filemaker error message map
{}
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
Class Method Summary collapse
-
.getError(code, message = nil) ⇒ Object
This method instantiates and returns the appropriate FileMakerError object depending on the error code passed to it.
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
36 37 38 |
# File 'lib/rfm_error.rb', line 36 def code @code end |
Class Method Details
.getError(code, message = nil) ⇒ Object
This method instantiates and returns the appropriate FileMakerError object depending on the error code passed to it. It also accepts an optional message.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/rfm_error.rb', line 43 def self.getError(code, = nil) if == nil or .size == 0 (0..99).each{|i| [i] = 'SystemError occurred.'} (100..199).each{|i| [i] = 'MissingError occurred.'} [102] = 'FieldMissingError occurred.' [104] = 'ScriptMissingError occurred.' [105] = 'LayoutMissingError occurred.' [106] = 'TableMissingError occurred.' (200..299).each{|i| [i] = 'SecurityError occurred.'} [200] = 'RecordAccessDeniedError occurred.' [201] = 'FieldCannotBeModifiedError occurred.' [202] = 'FieldAccessIsDeniedError occurred.' (300..399).each{|i| [i] = 'ConcurrencyError occurred.'} [301] = 'RecordInUseError occurred.' [302] = 'TableInUseError occurred.' [306] = 'RecordModIdDoesNotMatchError occurred.' (400..499).each{|i| [i] = 'GeneralError occurred.'} [401] = 'NoRecordsFoundError occurred.' (500..599).each{|i| [i] = 'ValidationError occurred.'} [500] = 'DateValidationError occurred.' [501] = 'TimeValidationError occurred.' [502] = 'NumberValidationError occurred.' [503] = 'RangeValidationError occurred.' [504] = 'UniqueValidationError occurred.' [505] = 'ExistingValidationError occurred.' [506] = 'ValueListValidationError occurred.' [507] = 'ValidationCalculationError occurred.' [508] = 'InvalidFindModeValueError occurred.' [511] = 'MaximumCharactersValidationError occurred.' (800..899).each{|i| [i] = 'FileError occurred.'} [802] = 'UnableToOpenFileError occurred.' end = [code] if == nil || .strip == '' += " (FileMaker Error ##{code})" if 0 <= code and code <= 99 err = SystemError.new() elsif 100 <= code and code <= 199 if code == 101 err = RecordMissingError.new() elsif code == 102 err = FieldMissingError.new() elsif code == 104 err = ScriptMissingError.new() elsif code == 105 err = LayoutMissingError.new() elsif code == 106 err = TableMissingError.new() else err = MissingError.new() end elsif 200 <= code and code <= 299 if code == 200 err = RecordAccessDeniedError.new() elsif code == 201 err = FieldCannotBeModifiedError.new() elsif code == 202 err = FieldAccessIsDeniedError.new() else err = SecurityError.new() end elsif 300 <= code and code <= 399 if code == 301 err = RecordInUseError.new() elsif code == 302 err = TableInUseError.new() elsif code == 306 err = RecordModIdDoesNotMatchError.new() else err = ConcurrencyError.new() end elsif 400 <= code and code <= 499 if code == 401 err = NoRecordsFoundError.new() else err = GeneralError.new() end elsif 500 <= code and code <= 599 if code == 500 err = DateValidationError.new() elsif code == 501 err = TimeValidationError.new() elsif code == 502 err = NumberValidationError.new() elsif code == 503 err = RangeValidationError.new() elsif code == 504 err = UniqueValidationError.new() elsif code == 505 err = ExistingValidationError.new() elsif code == 506 err = ValueListValidationError.new() elsif code == 507 err = ValidationCalculationError.new() elsif code == 508 err = InvalidFindModeValueError.new() elsif code == 511 err = MaximumCharactersValidationError.new() else err = ValidationError.new() end elsif 800 <= code and code <= 899 if code == 802 err = UnableToOpenFileError.new() else err = FileError.new() end else # called for code == -1 or any other code not handled above. err = UnknownError.new() end err.code = code return err end |