jjzjj

assert_throws

全部标签

javascript - 未处理的 promise 拒绝警告 : This error originated either by throwing inside of an async function without a catch block

我的Node-Express应用出现以下错误UnhandledPromiseRejectionWarning:Unhandledpromiserejection.Thiserrororiginatedeitherbythrowinginsideofanasyncfunctionwithoutacatchblock,orbyrejectingapromisewhichwasnothandledwith.catch().(rejectionid:4)至少可以说,我创建了一个看起来像这样的辅助函数constgetEmails=(userID,targettedEndpoint,headerA

javascript - 事件.js :85 throw er;//Unhandled 'error' event

我正在尝试设置一个Twitter应用程序,但我目前遇到以下错误:$nodetwitter.jsevents.js:85thrower;//Unhandled'error'event^SyntaxError:UnexpectedtokenUatObject.parse(native)atEventEmitter.receive(/Users/user/Documents/twitter/node_modules/twitter/lib/parser.js:40:21)atIncomingMessage.(/Users/user/Documents/twitter/node_modules

javascript - 为什么 "[value=' ' ]"throw an exception in IE7 and ":not(:not([value ='' ]))"does not?

我正在尝试通过jQuery从选择框中选择选项标签(值为“”的选项)。我使用以下选择器:$("[value='']");这适用于大多数浏览器,但在IE7中它会抛出异常。如果我将其更改为以下(恕我直言)选择器,则它可以正常工作:$(":not(:not([value='']))");我宁愿不使用后者,但想不出更好的等价物。编辑:jQuery版本:1.3.1.异常:MicrosoftJScript运行时错误:抛出异常但未捕获在if(S==null){throw"Syntaxerror,unrecognizedexpression:"+ab}在哪里ab="value='']"测试设置:为确保我

javascript - Node |模块.js :540 throw err

所以这是我编写的第一个程序,但是当我在控制台中运行它时出现此错误。module.js:540throwerr;^Error:Cannotfindmodule'C:\Users\Daniel\Desktop\app'atFunction.Module._resolveFilename(module.js:538:15)atFunction.Module._load(module.js:468:25)atFunction.Module.runMain(module.js:684:10)atstartup(bootstrap_node.js:187:16)atbootstrap_node.j

javascript - throw() 生成的 node.js uncaughtException 上缺少堆栈跟踪

我正在trycatchnode.jsuncaughtException的堆栈跟踪,它适用于不同的错误,但不适用于throw()语句:更正异常处理的堆栈跟踪:$caterrorFunc.jsprocess.on('uncaughtException',function(exception){console.log('uncaughtExceptionoccurred:'+exception.stack);});MyError();$nodeerrorFunc.jsuncaughtExceptionoccurred:ReferenceError:MyErrorisnotdefinedatO

javascript - mocha with nodejs assert 挂起/超时为 assert(false) 而不是错误

我有这种Mocha测试:describe'sabah',→beforeEach→@sabahStrategy=_.filter(@strats,{name:'sabah2'})[0].stratit'articlelistshouldbepopulated',(done)→@timeout10000strat=new@sabahStrategy()articles=strat.getArticleStream('barlas')articles.take(2).toArray((result)→_.each(result,(articleList)→//Imaketheassertio

Javascript/正则表达式 : Lookbehind Assertion is causing a "Invalid group" error

我正在做一个简单的LookbehindAssertion来获取URL的一部分(下面的示例),但我没有获得匹配,而是收到以下错误:UncaughtSyntaxError:Invalidregularexpression:/(?这是我正在运行的脚本:varurl=window.location.toString();url==http://my.domain.com/index.php/#!/write-stuff/something-else//lookbehindtoonlymatchthesegmentafterthehash-bang.varregex=/(?结果应该是write-

javascript - 为什么 Node.js Assert 没有 notOk() 方法?

我正在学习如何使用mocha和assert模块在Node.js中进行测试。assert有这些类型的方法:assert.equal();assert.deepEqual();assert.deepStrict();assert.strict();assert.ok();//Isthevaluetrue?还有一些对立面:assert.notEqual();assert.notDeepEqual();assert.notDeepStrict();assert.notStrict();但是缺少一个...为什么没有notOk()方法来测试结果值是否为false?这让我想到,也许我在一般单元测试中

javascript - "Assertion failed: you need to wait for the runtime to be ready"在JavaScript中调用C函数时出错

我正在尝试一个简单的示例来调用使用JavaScript编译为.wasm的C函数。这是counter.c文件:#includeintcounter=100;EMSCRIPTEN_KEEPALIVEintcount(){counter+=1;returncounter;}我使用emcccounter.c-sWASM=1-ocounter.js编译了它。我的main.jsJavaScript文件:constcount=Module.cwrap('count','number');console.log(count());我的index.html文件只加载正文中的两个.js文件,没有别的:我得

javascript - Firebase "throw new Error(' 提供的服务帐户无效');"错误消息

我注意到Firebase最近发生了变化。我正在构建一个需要firebase的node.js应用程序,以前这就足够了:varFirebase=require("firebase");varfirebaseRef=newFirebase("https://blabla.firebaseio.com/");根据此链接:https://firebase.google.com/docs/web/setup#prerequisites您需要在新的firebase控制台中创建一个firebase项目,然后将firebase添加到您的网络应用程序中。这给你类似的东西://InitializeFireb