{"record":{"id":"886c5d7772732030","repo":"RubyMoney/money","slug":"must-be-initialized-with-a-finite-value","errorCode":null,"errorMessage":"must be initialized with a finite value","messagePattern":"must be initialized with a finite value","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/money/money.rb","lineNumber":370,"sourceCode":"  # @example\n  #   Money.new(100)        #=> #<Money @fractional=100 @currency=\"USD\">\n  #   Money.new(100, \"USD\") #=> #<Money @fractional=100 @currency=\"USD\">\n  #   Money.new(100, \"EUR\") #=> #<Money @fractional=100 @currency=\"EUR\">\n  #\n  def initialize(obj, currency = nil, options = {})\n    # For backwards compatibility, if options is not a Hash, treat it as a bank parameter\n    unless options.is_a?(Hash)\n      options = { bank: options }\n    end\n\n    @fractional = as_d(obj.respond_to?(:fractional) ? obj.fractional : obj)\n    @currency   = obj.respond_to?(:currency) ? obj.currency : Currency.wrap(currency)\n    @currency ||= Money.default_currency\n    @bank       = obj.respond_to?(:bank) ? obj.bank : options[:bank]\n    @bank     ||= Money.default_bank\n\n    # BigDecimal can be Infinity and NaN, money of that amount does not make sense\n    raise ArgumentError, \"must be initialized with a finite value\" unless @fractional.finite?\n    raise Currency::NoCurrency, \"must provide a currency\" if @currency.nil?\n  end\n\n  # DEPRECATED.\n  #\n  # @see #amount\n  def dollars\n    warn \"[DEPRECATION] `Money#dollars` is deprecated in favor of \" \\\n         \"`Money#amount`.\"\n\n    amount\n  end\n\n  # Returns the numerical value of the money.\n  #\n  # @return [BigDecimal]\n  #\n  # @example","sourceCodeStart":352,"sourceCodeEnd":388,"githubUrl":"https://github.com/RubyMoney/money/blob/26e2829c34f165847040a5a40d4d2daa5eb72927/lib/money/money.rb#L352-L388","documentation":"Error \"must be initialized with a finite value\" thrown in RubyMoney/money.","triggerScenarios":"Thrown at lib/money/money.rb:370 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"26e2829c34f165847040a5a40d4d2daa5eb72927","analyzedAt":"2026-08-23T17:41:07.306Z","schemaVersion":2},"datasetVersion":"2026-08-23T21:17:23.414Z"}