summaryrefslogtreecommitdiff
path: root/bitbucket-widget
diff options
context:
space:
mode:
authorstreetturtle <streetturtle@gmail.com>2020-04-23 20:15:30 -0400
committerstreetturtle <streetturtle@gmail.com>2020-04-23 20:15:30 -0400
commit285b71097f7983266f844896e003bdd6109869b1 (patch)
tree0e0e908bd71e9b651b8403dfa568f6fa2f08acb7 /bitbucket-widget
parent36e40a9dd6d27f430f5c68b6b2108b72573ca515 (diff)
Handle network issues
Diffstat (limited to 'bitbucket-widget')
-rw-r--r--bitbucket-widget/bitbucket.lua7
1 files changed, 5 insertions, 2 deletions
diff --git a/bitbucket-widget/bitbucket.lua b/bitbucket-widget/bitbucket.lua
index 6cd57e2..0ea5e90 100644
--- a/bitbucket-widget/bitbucket.lua
+++ b/bitbucket-widget/bitbucket.lua
@@ -20,7 +20,7 @@ local gfs = require("gears.filesystem")
local HOME_DIR = os.getenv("HOME")
-local GET_PRS_CMD= [[bash -c "curl -s -n '%s/2.0/repositories/%s/%s/pullrequests?fields=values.title,values.links.html,values.author.display_name,values.author.uuid,values.author.links.avatar&q=%%28author.uuid+%%3D+%%22%s%%22+OR+reviewers.uuid+%%3D+%%22%s%%22+%%29+AND+state+%%3D+%%22OPEN%%22' | jq '.[] | unique'"]]
+local GET_PRS_CMD= [[bash -c "curl -s --show-error -n '%s/2.0/repositories/%s/%s/pullrequests?fields=values.title,values.links.html,values.author.display_name,values.author.uuid,values.author.links.avatar&q=%%28author.uuid+%%3D+%%22%s%%22+OR+reviewers.uuid+%%3D+%%22%s%%22+%%29+AND+state+%%3D+%%22OPEN%%22' | jq '.[] | unique'"]]
local DOWNLOAD_AVATAR_CMD = [[bash -c "curl -n --create-dirs -o %s/.cache/awmw/bitbucket-widget/avatars/%s %s"]]
local bitbucket_widget = {}
@@ -83,7 +83,10 @@ local function worker(args)
}
local update_widget = function(widget, stdout, stderr, _, _)
- if stderr ~= '' then show_warning(stderr) end
+ if stderr ~= '' then
+ show_warning(stderr)
+ return
+ end
local result = json.decode(stdout)