Loading lib/jsduck/app.rb +10 −8 Original line number Diff line number Diff line Loading @@ -107,10 +107,7 @@ module JsDuck begin SourceFile.new(JsDuck::IO.read(fname), fname, @opts) rescue puts "Error while parsing #{fname}: #{$!}" puts puts "Here's a full backtrace:" puts $!.backtrace Logger.instance.fatal("Error while parsing #{fname}", $!) exit(1) end end Loading Loading @@ -167,10 +164,15 @@ module JsDuck # Format all doc-objects in parallel formatted_classes = @parallel.map(@relations.classes) do |cls| Logger.instance.log("Markdown formatting #{cls[:name]}") begin { :doc => class_formatter.format(cls.internal_doc), :images => doc_formatter.images } rescue Logger.instance.fatal("Error while formatting #{cls[:name]}", $!) exit(1) end end # Then merge the data back to classes sequentially formatted_classes.each do |cls| Loading lib/jsduck/guides.rb +13 −7 Original line number Diff line number Diff line Loading @@ -59,6 +59,8 @@ module JsDuck def load_guide(guide) in_dir = @path + "/guides/" + guide["name"] begin return Logger.instance.warn(:guide, "Guide #{in_dir} not found") unless File.exists?(in_dir) guide_file = in_dir + "/README.md" Loading @@ -69,6 +71,10 @@ module JsDuck @formatter.img_path = "guides/#{name}" return add_toc(guide, @formatter.format(JsDuck::IO.read(guide_file))) rescue Logger.instance.fatal("Error while reading/formatting guide #{in_dir}", $!) exit(1) end end def write_guide(guide, dir) Loading lib/jsduck/logger.rb +9 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,15 @@ module JsDuck end out end # Prints fatal error message with backtrace. # The error param should be $! from resque block. def fatal(msg, error) puts "#{msg}: #{error}" puts puts "Here's a full backtrace:" puts error.backtrace end end end Loading
lib/jsduck/app.rb +10 −8 Original line number Diff line number Diff line Loading @@ -107,10 +107,7 @@ module JsDuck begin SourceFile.new(JsDuck::IO.read(fname), fname, @opts) rescue puts "Error while parsing #{fname}: #{$!}" puts puts "Here's a full backtrace:" puts $!.backtrace Logger.instance.fatal("Error while parsing #{fname}", $!) exit(1) end end Loading Loading @@ -167,10 +164,15 @@ module JsDuck # Format all doc-objects in parallel formatted_classes = @parallel.map(@relations.classes) do |cls| Logger.instance.log("Markdown formatting #{cls[:name]}") begin { :doc => class_formatter.format(cls.internal_doc), :images => doc_formatter.images } rescue Logger.instance.fatal("Error while formatting #{cls[:name]}", $!) exit(1) end end # Then merge the data back to classes sequentially formatted_classes.each do |cls| Loading
lib/jsduck/guides.rb +13 −7 Original line number Diff line number Diff line Loading @@ -59,6 +59,8 @@ module JsDuck def load_guide(guide) in_dir = @path + "/guides/" + guide["name"] begin return Logger.instance.warn(:guide, "Guide #{in_dir} not found") unless File.exists?(in_dir) guide_file = in_dir + "/README.md" Loading @@ -69,6 +71,10 @@ module JsDuck @formatter.img_path = "guides/#{name}" return add_toc(guide, @formatter.format(JsDuck::IO.read(guide_file))) rescue Logger.instance.fatal("Error while reading/formatting guide #{in_dir}", $!) exit(1) end end def write_guide(guide, dir) Loading
lib/jsduck/logger.rb +9 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,15 @@ module JsDuck end out end # Prints fatal error message with backtrace. # The error param should be $! from resque block. def fatal(msg, error) puts "#{msg}: #{error}" puts puts "Here's a full backtrace:" puts error.backtrace end end end