-
-
Save mguinada/bd2df384b3bbf2a97a10f16a7a107cd3 to your computer and use it in GitHub Desktop.
Revisions
-
rks created this gist
May 2, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,41 @@ class CustomError < StandardError def initialize(e = nil) super e set_backtrace e.backtrace if e end end def run r = Runner.new r.fail end class Runner def fail _fail end def _fail service = RunnerService.new service.fail rescue StandardError => e raise CustomError.new(e) end end class RunnerService def fail _fail end def _fail raise StandardError.new('Service failed') end end begin run rescue CustomError => e puts e.message puts ' ' + e.backtrace.join("\n ") end