mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-19 21:03:46 +00:00
added some protection against potential error cases if grokerSubdomain isn't properly set
This commit is contained in:
@@ -248,6 +248,9 @@ def updated() {
|
|||||||
if (atomicState.eventBuffer == null) {
|
if (atomicState.eventBuffer == null) {
|
||||||
atomicState.eventBuffer = []
|
atomicState.eventBuffer = []
|
||||||
}
|
}
|
||||||
|
if (atomicState.grokerSubdomain == null || atomicState.grokerSubdomain == "") {
|
||||||
|
atomicState.grokerSubdomain = "groker"
|
||||||
|
}
|
||||||
|
|
||||||
subscribeToEvents()
|
subscribeToEvents()
|
||||||
|
|
||||||
@@ -260,6 +263,11 @@ def uninstalled() {
|
|||||||
|
|
||||||
def tryCreateBucket() {
|
def tryCreateBucket() {
|
||||||
|
|
||||||
|
// can't ship events if there is no grokerSubdomain
|
||||||
|
if (atomicState.grokerSubdomain == null || atomicState.grokerSubdomain == "") {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// if the bucket has already been created, no need to continue
|
// if the bucket has already been created, no need to continue
|
||||||
if (atomicState.isBucketCreated) {
|
if (atomicState.isBucketCreated) {
|
||||||
return
|
return
|
||||||
@@ -346,6 +354,10 @@ def eventHandler(name, value) {
|
|||||||
// a helper function for shipping the atomicState.eventBuffer to Initial State
|
// a helper function for shipping the atomicState.eventBuffer to Initial State
|
||||||
def tryShipEvents() {
|
def tryShipEvents() {
|
||||||
|
|
||||||
|
// can't ship events if there is no grokerSubdomain
|
||||||
|
if (atomicState.grokerSubdomain == null || atomicState.grokerSubdomain == "") {
|
||||||
|
return
|
||||||
|
}
|
||||||
// can't ship if access key and bucket key are null, so finish trying
|
// can't ship if access key and bucket key are null, so finish trying
|
||||||
if (atomicState.accessKey == null || atomicState.bucketKey == null) {
|
if (atomicState.accessKey == null || atomicState.bucketKey == null) {
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user