Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Add stacktrace logging #339

Merged

Conversation

ruslan-bikkinin
Copy link
Contributor

This PR add stacktrace logging which is will be very handy to debug errors.

@@ -66,7 +66,11 @@ class CodePushUtil {
*/
public static logError(message: String, error?: Error): void {
var errorMessage = message || "" + " " + CodePushUtil.getErrorMessage(error);
console.error(CodePushUtil.TAG + " " + errorMessage);
var stackTrace = '';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great to use let instead of var and const instead of let if possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thx

if (error.stack) {
stackTrace += '. Stacktrace: ' + error.stack;
}
console.error(CodePushUtil.TAG + " " + errorMessage + stackTrace);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use template literals for text formatting instead of +

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thx

console.error(CodePushUtil.TAG + " " + errorMessage);
var stackTrace = '';
if (error.stack) {
stackTrace += '. Stacktrace: ' + error.stack;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stacktrace -> StackTrace

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thx

Copy link
Contributor

@sergey-akhalkov sergey-akhalkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ruslan-bikkinin ruslan-bikkinin merged commit 3ff5958 into microsoft:master Dec 26, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants