Unclear where Check error originates from


#1

hi

I use the check package,

I noticed multiple times that it can be very hard to figure out where this check goes wrong (which module, linenumber), any ideas how we can fix this, and maybe adjust the error message?

the console.log output:

Exception while invoking method 'copyAppForOneCustomer' ReferenceError: object is not defined
I20160602-15:44:16.089(2)?     at packages/ddp-server/livedata_server.js:711:19
I20160602-15:44:16.089(2)?     at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1704:12)
I20160602-15:44:16.088(2)?     at [object Object].copyAppForOneCustomer (server/main.js:60:25)
I20160602-15:44:16.089(2)?     at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
I20160602-15:44:16.090(2)?     at packages/ddp-server/livedata_server.js:709:40
I20160602-15:44:16.090(2)?     at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
I20160602-15:44:16.090(2)?     at packages/ddp-server/livedata_server.js:707:46
I20160602-15:44:16.091(2)?     at doResolve (C:\Users\MBJ\AppData\Local\.meteor\packages\promise\0.6.7\npm\node_modules\meteor-promise\node_modules\promise\lib\core.js:200:13)
I20160602-15:44:16.090(2)?     at tryCallTwo (C:\Users\MBJ\AppData\Local\.meteor\packages\promise\0.6.7\npm\node_modules\meteor-promise\node_modules\promise\lib\core.js:45:5)
I20160602-15:44:16.091(2)?     at new Promise (C:\Users\MBJ\AppData\Local\.meteor\packages\promise\0.6.7\npm\node_modules\meteor-promise\node_modules\promise\lib\core.js:66:3)

my code

copyAppForOneCustomer(customer) {
        check(customer, Object);
        if (TemplateApps.find({ checked: true })) {
            Promise.all(
                    TemplateApps.find({ checked: true })
                    .forEach(function(template) {
                        return QSApp.copyApp(template.guid, customer.name + '-' + template.name);
                    })
                )
                .then(function() {
                    return 'Apps copied';
                })
        }else{
            throw new Meteor.Error('no Template Apps', 'Please select a template first');
        }
    },

#2

Or should you make a try catch around the check package? thanks