{"record":{"id":"64fd0294943f7344","repo":"sj26/mailcatcher","slug":"exception-exception","errorCode":null,"errorMessage":"    Exception: #{exception}","messagePattern":"    Exception: #(.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/mail_catcher.rb","lineNumber":62,"sourceCode":"  def browsable?\n    windows? or which? \"open\"\n  end\n\n  def browse url\n    if windows?\n      system \"start\", \"/b\", url\n    elsif which? \"open\"\n      system \"open\", url\n    end\n  end\n\n  def log_exception(message, context, exception)\n    gems_paths = (Gem.path | [Gem.default_dir]).map { |path| Regexp.escape(path) }\n    gems_regexp = %r{(?:#{gems_paths.join(\"|\")})/gems/([^/]+)-([\\w.]+)/(.*)}\n    gems_replace = '\\1 (\\2) \\3'\n\n    puts \"*** #{message}: #{context.inspect}\"\n    puts \"    Exception: #{exception}\"\n    puts \"    Backtrace:\", *exception.backtrace.map { |line| \"       #{line.sub(gems_regexp, gems_replace)}\" }\n    puts \"    Please submit this as an issue at https://github.com/sj26/mailcatcher/issues\"\n  end\n\n  @@defaults = {\n    :smtp_ip => \"127.0.0.1\",\n    :smtp_port => \"1025\",\n    :http_ip => \"127.0.0.1\",\n    :http_port => \"1080\",\n    :http_path => \"/\",\n    :messages_limit => nil,\n    :verbose => false,\n    :daemon => !windows?,\n    :browse => false,\n    :quit => true,\n  }\n\n  def options","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/sj26/mailcatcher/blob/18a9cb7a79b321b2bcb51608dd793ea51255189e/lib/mail_catcher.rb#L44-L80","documentation":"The second line of MailCatcher's log_exception report (lib/mail_catcher.rb:62): it prints the caught exception via string interpolation (`#{}=> exception.to_s`), giving `Class: message` — e.g. `SQLite3::SQLException: ...` or `Errno::EPIPE: Broken pipe`. This line is the actual diagnosis; the surrounding lines are context and backtrace.","triggerScenarios":"Any exception swallowed by the two internal rescues: smtp.rb:62 catching failures while storing a message (SQLite3 insert errors, Mail MIME parse raising), and application.rb:89 catching failures of Faye ws.send to a dead browser connection (IOError, EPIPE). What appears here is whatever those rescues caught.","commonSituations":"Triaging a `451`/delivery failure reported by an SMTP client and matching it to this line; sqlite3 gem major-version incompatibility raising on message insert; browsers disconnecting (tab close, sleep) while the Bus broadcasts a new message; Ruby upgrades changing encoding behavior on binary mail parts.","solutions":["Identify the exception class on this line and resolve by that class: SQLite3::* -> fix gem pairing; IOError/EPIPE -> transient client disconnect, safe to ignore; NoMethodError/ArgumentError in mail parsing -> inspect the message source from the context line.","Run `mailcatcher -f -v` so the report prints to your terminal instead of being swallowed by daemon mode.","Search the exact exception string in https://github.com/sj26/mailcatcher/issues — recurring classes (sqlite3 null-byte, encoding) have known fixes.","If unclassifiable, capture the whole block (context + exception + backtrace) and file an issue."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"# Classify by the exception the report prints, then decide\nbegin\n  MailCatcher::Mail.add_message(msg)\nrescue SQLite3::Exception => e\n  abort \"incompatible sqlite3 for mailcatcher: #{e.message} — pin sqlite3 ~> 1.3\"\nrescue StandardError => e\n  warn \"unclassified: #{e.class}: #{e.message}\" # corresponds to the printed 'Exception:' line\nend","preventionTips":["Grep daemon logs for 'Exception:' lines after gem updates instead of relying on SMTP client symptoms.","Keep a pinned set of gem versions for the mailcatcher bundle; record what changed when reports appear.","Distinguish disconnect classes (EPIPE/IOError -> ignore) from storage/parse classes (act) before debugging."],"tags":["logging","exception-message","diagnostics"],"backgroundTag":"exception-message-logging","analyzedSha":"18a9cb7a79b321b2bcb51608dd793ea51255189e","analyzedAt":"2026-08-21T18:56:10.605Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}