[gnome-maps] Utils: If Error is passed to debug() print stack
- From: Jonas Danielsson <jonasdn src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps] Utils: If Error is passed to debug() print stack
- Date: Sun, 10 Jan 2016 10:26:46 +0000 (UTC)
commit 47e52ea11a739f3a8df2abf74db33d297127d25f
Author: Hashem Nasarat <hashem riseup net>
Date: Sun Jan 10 01:42:23 2016 -0500
Utils: If Error is passed to debug() print stack
This helps in development if unexpected errors occur in sections that
do error handling and logging. By having the stack you can observe
the unexpected errors and fix the issue.
https://bugzilla.gnome.org/show_bug.cgi?id=759544
src/utils.js | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/utils.js b/src/utils.js
index caa1b84..d55bdb2 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -41,7 +41,7 @@ let debugInit = false;
let debugEnabled = false;
let measurementSystem = null;
-function debug(str) {
+function debug(msg) {
if (!debugInit) {
let env = GLib.getenv('MAPS_DEBUG');
if (env)
@@ -50,8 +50,11 @@ function debug(str) {
debugInit = true;
}
- if (debugEnabled)
- log('DEBUG: ' + str);
+ if (debugEnabled) {
+ log('DEBUG: ' + msg);
+ if (msg instanceof Error)
+ log(msg.stack);
+ }
}
// Connect to a signal on an object and disconnect on its first emission.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]