Module: Envjs

Defined in:
lib/envjs.rb

Defined Under Namespace

Modules: Net, Runtime Classes: TempFile

Constant Summary collapse

ENVJS =
File.expand_path( File.join( File.dirname(__FILE__),
"envjs",
"env.js" ) )

Class Method Summary collapse

Class Method Details

.js_exception_stack(e) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/envjs.rb', line 3

def self.js_exception_stack e
  result = %(Exception: )+e.to_s
  e.stack.to_s.split(%(\n)).each do |line|
    next if line == "@:0"
    m = line.match(/(.*)@([^@]*)$/)
    s = m[1]
    limit = 50
    if ( s.length > limit )
      s = s[0,limit] + %(...)
    end
    result += "\n" + m[2]+%( )+s
  end
  result
end