简体   繁体   English

回调函数未抛出错误时未定义错误

[英]Error is undefined when to callback function not throwing error

var callback = dojo.lang.hitch(this, this.getCallbackReview); //This is used to call callback funstion after line2
this.service.ReviewManager.getReview(callback, path, ItemPath, true); //use to call java method which returns Pojo

//This is callback function
getCallbackReview: function(info, error) {
    if(error) {
        alert(error); //in case of any error from the java method
        return;
     }
     alert(info); //If no error thrown from Java Method
},

The second is not throwing any error and returning proper info but if this info has clob field then giving me error as undefined. 第二个方法是不抛出任何错误并返回正确的信息,但是如果此信息具有clob字段,则给我未定义的错误。

In this line of code: 在这行代码中:

var callback = dojo.lang.hitch(this, this.getCallbackReview);

You pass as as scope this.getCallbackReview but this property is not defined in your code snippet. 您将this.getCallbackReview作为范围传递,但此属性未在代码段中定义。 To fix it you should consider adding getCallbackReview as property so 要修复它,您应该考虑将getCallbackReview作为属性添加,以便

this.getCallbackReview = function(info, error) {
   ...
},

or alternativelly: 或者:

var callback = dojo.lang.hitch(this, getCallbackReview);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 停止函数并回调而不是引发错误 - Stop the function and callback instead of throwing error 数组上的 map function 抛出未定义的错误 - map function on an array throwing undefined error 在未定义中绑定时 Knex 抛出错误 - Knex Throwing Error When Binding in undefined 在异步函数中的回调参数上获取未定义的错误 - Getting undefined error on callback argument in async function 授权错误:未定义“未给出回调 function。” - Authorization error: undefined 'No callback function was given.' 当没有错误时,回调应该传递 null 还是 undefined? - Should a callback be passed null or undefined when there is no error? 未调用回调函数中的React组件并且不引发任何错误 - React Component in Callback Function not called and not throwing any error Yii-当我想调用update()函数时,jQuery.fn.yiiGridView引发未定义的错误 - Yii - jQuery.fn.yiiGridView throwing undefined error when I want to call update() function 抛出错误时返回的函数是什么 - Javascript - What is the function return when throwing an error - Javascript “错误:Route.get() 需要回调 function 但得到 [object Undefined]” 进行多次导出时 - “Error: Route.get() requires a callback function but got a [object Undefined]” when doing multiple exporting
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM