Sha256: ee1d46f1d78aa974ea2f013665a7be5915cabee02cca4b0f1577e8f27b97c741

Contents?: true

Size: 998 Bytes

Versions: 6

Compression:

Stored size: 998 Bytes

Contents

module H8

  # The exception that H8 raises on errors that are not caused by executing
  # javascript (e.g. bad parameters, illegal conversion and so on)
  class Error < StandardError
  end

  # The general error caused by the script execution, e.g. uncaught javascript exceptinos and like.
  # Check #message to see the cause.
  class JsError < Error
    # Error message
    attr :message

    # Javascript Error object. May be nil
    attr :javascript_error

    def to_s
      message
    end

    # Error name
    def name
      @javascript_error.name ? @javascript_error.name : message
    end

    # String that represents stack trace if any as multiline string (\n separated)
    def javascript_backtrace
      @javascript_error ? @javascript_error.stack : message
    end

  end

  # Script execution is timed out (see H8::Context#eval timeout parameter)
  class TimeoutError < JsError
    def initialize message
      super
      @message = message
      @source = nil
    end
  end


end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
h8-0.2.2 lib/h8/errors.rb
h8-0.2.1 lib/h8/errors.rb
h8-0.1.4 lib/h8/errors.rb
h8-0.1.3 lib/h8/errors.rb
h8-0.1.2 lib/h8/errors.rb
h8-0.1.1 lib/h8/errors.rb