Commit 4d3fae5b authored by Caleb Weeks's avatar Caleb Weeks

propogating data on err case

parent 38858c38
......@@ -202,7 +202,9 @@ SC.getSling = async function(path, options = {}, callback){
if(!err){
resolve(data);
}else{
reject(_.isString(err) ? new Error(err) : err);
err = _.isString(err) ? new Error(err) : err
err.slingData = data;
reject(err);
}
})
})
......@@ -211,7 +213,6 @@ SC.getSling = async function(path, options = {}, callback){
//wrap the callback in a try / catch safe function
const actualCb = callback;
callback = (err, data) => {
try{
actualCb(err, data);
}catch(cbErr){
......@@ -260,7 +261,9 @@ SC.getSling = async function(path, options = {}, callback){
let data = await sc_self.inMemoryCache[path];
callback(null, data);
} catch(err){
callback(err);
const errData = err.slingData
delete err.slingData;
callback(err, errData);
}
}else{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment