Missing Error Messages?

Discussion in 'Mod Support' started by wondible, September 24, 2015.

  1. wondible

    wondible Post Master General

    Messages:
    3,279
    Likes Received:
    2,084
    I don't seem be getting error messages for undefined symbols anymore. Just nothing happens, and I'm back to putting in console logs until I find the point where it stops (or notice the error while doing so)
  2. wondible

    wondible Post Master General

    Messages:
    3,279
    Likes Received:
    2,084
    I think I finally figured this out. I've been using promise based apis more, and both coherent promises (return from engine.call) and jQuery.Deferred will swallow errors in thens.

    I made a hack for coherent promises:

    Code:
    var Promise = engine.createDeferred().constructor
    Promise.prototype.make_chain = function (handler, promise, ok) {
      return function (result) {
        var handlerResult;
        try {
          handlerResult = handler.code.call(handler.context, result);
          if (handlerResult instanceof Promise) {
            handlerResult.merge(promise);
          } else if (this.state === ok) {
            promise.resolve(handlerResult);
          } else {
            promise.reject(handlerResult);
          }
        } catch (error) {
          console.log(error.stack) // *******
          promise.reject(error);
        }
      };
    };
    
    
    dom314 likes this.

Share This Page