# encoding: utf-8 module LocalPac module ProxyPac class PACEngine private attr_reader :engine, :file public def initialize(options = {}) @file = options.fetch(:file) @engine = PAC rescue KeyError fail ArgumentError, ":file-option is missing" end def find(uri) e = engine.source(file.content) e.find(uri) rescue V8::Error, PAC::ProgramError => err error_id = LocalPac.error_id LocalPac.ui_logger.fatal "Error id \"#{error_id}\": An V8::Error occured. This can happen if compiling a proxy.pac fails. The V8::Error-message was: #{err.message}." fail Exceptions::PacFileInvalid, error_id end end end end