Skip to content

Commit

Permalink
Add more detailed logging
Browse files Browse the repository at this point in the history
  • Loading branch information
tabeth committed Nov 8, 2019
1 parent de58e08 commit 8d7b316
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ collibra-connector.js
local*
build
dist
*/**/collibra.sh
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "generic-dq-connector",
"version": "1.1.1",
"version": "1.1.2",
"description": "A connector that sends Pandora and Aperture Data Studio rules to a governance platform of choice",
"main": "index.js",
"scripts": {
Expand Down
30 changes: 15 additions & 15 deletions src/collibra/collibra-connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export class CollibraConnector extends Connector {
log("Querying rule data...", 4);
setEnvVar(this.env, "HTTP_ODBC_RULE_QUERY", true);
} catch(e) {
log(e, "error");
log(JSON.stringify(e), "error");
return new Promise((resolve) => { resolve(null) });
}

Expand Down Expand Up @@ -587,7 +587,7 @@ export class CollibraConnector extends Connector {
try {
setEnvVar(this.env, "HTTP_ODBC_PROFILE_QUERY", true);
} catch(e) {
log(e, "error");
log(JSON.stringify(e), "error");
return new Promise((resolve) => { resolve(null) });
}

Expand All @@ -603,7 +603,7 @@ export class CollibraConnector extends Connector {
log("Querying profile data...", 4);
setEnvVar(this.env, "HTTP_ODBC_PROFILE_QUERY", true);
} catch(e) {
log(e, "error");
log(JSON.stringify(e), "error");
return new Promise((resolve) => { resolve(null) });
}

Expand Down Expand Up @@ -1009,8 +1009,8 @@ export class CollibraConnector extends Connector {
}
}).catch((error) => {
log("Session already found. Deleting...", 4);
log(error.code);
log(error.response.data);
log(JSON.stringify(error.code));
log(JSON.stringify(error.response.data));
axios.request({
url: `${this.env.COLLIBRA_URL}/rest/2.0/auth/sessions/current`,
method: "DELETE",
Expand All @@ -1019,8 +1019,8 @@ export class CollibraConnector extends Connector {
log("User logged out. Retrying...", 4);
resolve(this.authenticate(username, password));
}).catch((error) => {
log(error.response.data, 2);
reject(error);
log(JSON.stringify(error.response.data), 2);
reject(JSON.stringify(error));
})
});
})
Expand Down Expand Up @@ -1058,7 +1058,7 @@ export class CollibraConnector extends Connector {
clearInterval(cont);
log(`Import with Job Id: ${data.id} failed.`, 5);
log(`Values for Id: ${data.id} - ${ids[data.id]}`, 5);
reject(data);
reject(JSON.stringify(data));
}
else if (data.state === "COMPLETED") {
clearInterval(cont);
Expand All @@ -1073,8 +1073,8 @@ export class CollibraConnector extends Connector {
}, 1000)
}).catch((err) => {
log(`Import not successful.`, 5);
log(err.response.data, 2);
reject(err);
log(JSON.stringify(err.response.data), 2);
reject(JSON.stringify(err));
})
});
}
Expand Down Expand Up @@ -1133,8 +1133,8 @@ export class CollibraConnector extends Connector {
resolve(this.getOrCreateRelationTypes({coRole, role, sourceTypeId, targetTypeId, saveTo}))
}).catch((error: any) => {
log(`PostAssetError with parameters: ${JSON.stringify(args)}`, 2);
log(error.response.data, 2);
reject(error);
log(JSON.stringify(error.response.data), 2);
reject(JSON.stringify(error));
})

} else {
Expand All @@ -1144,8 +1144,8 @@ export class CollibraConnector extends Connector {
}
}).catch((error: any) => {
log(`RelationTypeError with parameters: ${JSON.stringify(args)}`, 2);
log(error.response.data, 2);
reject(error);
log(JSON.stringify(error.response.data), 2);
reject(JSON.stringify(error));
})
});
}
Expand Down Expand Up @@ -1187,7 +1187,7 @@ export class CollibraConnector extends Connector {

return profile[key];
} catch(e) {
log(e, "error");
log(JSON.stringify(e), "error");
return "";
}
}
Expand Down

0 comments on commit 8d7b316

Please sign in to comment.