- `Rails.root` is a `Pathname`, so let's use `Rails.root.join` - Clean up most of the remaining `File.join`s
25 lines
No EOL
721 B
Ruby
25 lines
No EOL
721 B
Ruby
# Copyright (c) 2010-2011, Diaspora Inc. This file is
|
|
# licensed under the Affero General Public License version 3 or later. See
|
|
# the COPYRIGHT file.
|
|
|
|
module Jobs
|
|
class Base
|
|
Dir[Rails.root.join('app', 'models', 'jobs', 'mail', '*.rb')].each {|file| require file }
|
|
|
|
#TODO these should be subclassed real exceptions
|
|
DUMB_ERROR_MESSAGES = [
|
|
"Contact required unless request",
|
|
"Relayable object, but no parent object found" ]
|
|
|
|
def self.suppress_annoying_errors(&block)
|
|
begin
|
|
yield
|
|
rescue => e
|
|
Rails.logger.info("error in job: #{e.message}")
|
|
unless DUMB_ERROR_MESSAGES.include?(e.message)
|
|
raise e
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end |