Module: Kernel

Includes:
Eprint
Defined in:
lib/Kernel.rb

Overview

this file is part of manqod manqod is distributed under the CDDL licence the author of manqod is Dobai-Pataky Balint([email protected])

Constant Summary

Constants included from Eprint

Eprint::DOMAIN, Eprint::LEVEL

Instance Method Summary collapse

Methods included from Eprint

#ecode, #edebug, #eerror, #einfo, #enormal, #eprint, #ewarn, #gtk_set_edebug, #set_edebug, #tell_exception

Instance Method Details

#erequire(filename, msg = "Please update your manqod installation\nFollow install instructions on http://manqod.sourceforge.net", optional = false) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/Kernel.rb', line 7

def erequire(filename,msg="Please update your manqod installation\nFollow install instructions on http://manqod.sourceforge.net",optional=false)
	handled=false
	begin
		require(filename)
		handled=true
	rescue LoadError => err
#			print "\t#{filename} module load error\n#{err}#{err.backtrace.join("\n")}\n---\n"
		if optional
			ewarn("Error Loading #{filename}\n#{msg}") 
			else
			warn("Error Loading #{filename}","#{err}","eval","error",false,false,msg) 
			raise err
		end
	rescue SyntaxError => err
#			print "#{filename} module syntax error\n#{err}\n"
		warn("\tSyntax Error in #{filename}","#{err}#{err.backtrace.join("\n")}","eval","error",false,false,msg) unless optional
	rescue => err
#			print "\t#{filename} module cannot be loaded\n#{err}\n#{err.backtrace.join("\n")}"
		warn("General error in #{filename}","#{err}#{err.backtrace.join("\n")}","eval","error",false,false,msg)
	end
	handled
end

#load(filename) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/Kernel.rb', line 30

def load(filename)
	begin
		handled=true
		super filename
	rescue LoadError => err
		warn("#{filename} module cannot be loaded",backtrace_to_debug(err),"main","error")
#			print "#{filename} module cannot be loaded\n #{err.backtrace.join("\n")}\n"
		handled=false
	rescue => err
		warn("error occured in module #{filename}",backtrace_to_debug(err),"main","error")
#			print "error occured in module #{filename}\n#{err.backtrace.join("\n")}"
		handled=false
	end
	handled
end