Navigation Menu

Skip to content

Commit

Permalink
Use to_s instead of "message", as the name of the method to stringify…
Browse files Browse the repository at this point in the history
… a startup error
  • Loading branch information
piroor committed Feb 12, 2014
1 parent 5158e40 commit c5f040c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/droonga/engine.rb
Expand Up @@ -24,7 +24,7 @@ def initialize(options={})
@options = options
@dispatcher = Dispatcher.new(@options)
rescue StartupError => error
$log.error(error.message)
$log.error(error.to_s)
exit(1)
end

Expand Down
19 changes: 8 additions & 11 deletions lib/droonga/startup_error.rb
Expand Up @@ -17,23 +17,20 @@

module Droonga
class StartupError < StandardError
attr_reader :message, :detail

def initialize(message, detail=nil)
@message = message
@detail = detail
end

def message
detail = self.detail
detail = "\n#{detail}" unless detail.empty?
"#{self.class.name}\n#{@message}#{detail}"
end

def detail
if @detail
@detail.to_s
else
""
def to_s
detail = @edatil
if detail
detail = detail.to_s
detail = "\n#{detail.to_s}" unless detail.empty?
end
"#{self.class.name}\n#{@message}#{detail}"
end
end
end

0 comments on commit c5f040c

Please sign in to comment.