IE8给出了非常奇怪的错误

时间:2016-05-09 10:03:27

标签: javascript internet-explorer-8

这是我收到的错误,

void handle_something(LogLevel lvl)
{
    switch(lvl)
    {
    case LogLevel::Trace:
        return "Trace";
    case LogLevel::Debug:
        return "Debug";
    case LogLevel::Info:
        return "Info";
    case LogLevel::Warning:
        return "Warning";
    case LogLevel::Error:
        return "Error";
    case LogLevel::Fatal:
        return "Fatal";
    // note: no default case - better not to suppress the warning
    }

    // handle the default case here

    // ok, so now we have a warning at compilation time if we miss one (good!)
    // next question: can the program possibly continue if this value is wrong?
   // if yes...
   return some_default_action();

   // ... do we want debug builds to stop here? Often yes since
   // ... this condition is symptomatic of a more serious problem
   // ... somewhere else

   std::assert(!"invalid log level");

   // ...if no, do we want to provide information as to why
   // ... which can be nested into an exception chain and presented
   // ... to someone for diagnosis?

   throw std::logic_error("invalid error level: " + std::to_string(static_cast<int>(lvl));

  // ... or are we in some mission-critical system which must abort and
  // ... restart the application when it encounters a logic error?

  store_error_in_syslog(fatal, "invalid log level");
  std::abort();
}

这是我正在使用的Microsoft的JS文件,

https://odatasamples.codeplex.com/SourceControl/latest#Tools/ODataQueryBuilder/Scripts/odata-query-builder.js

行:2031对我来说就是这样,

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Timestamp: Mon, 9 May 2016 09:54:15 UTC
Message: 'key' is null or not an object
Line: 2031
Char: 9
Code: 0
URI: https://www.example.com/Scripts/odata-query-builder.js

更新

我使用的是jQuery 1.9.1,因为IE8不支持2.0.0

更新2

为了让事情向前发展,我将这一位添加到选项,

$.each(options, function (index, e) {
Line 2031:        var $option = $('<option />', { value: e.key, text: e.value });

    if (typeof e.type !== 'undefined' && e.type == 'navigationProperty') {
        $option.addClass('navigationDropdown');
    }

    $option.appendTo(select);
});

但是现在我在第477行收到了另一个错误,Char 9

if(e){ rest of code here... }

0 个答案:

没有答案