Error codes should start at 1; reduce default deploy error timeout to 5 mins
diff --git a/api.go b/api.go
index 00dc633..1eced66 100644
--- a/api.go
+++ b/api.go
@@ -20,15 +20,15 @@
)
const (
- TRACKER_ERR_BUNDLE_TIMEOUT = iota
- TRACKER_ERR_PARSE_FAILED
- TRACKER_ERR_INVALID_CHECKSUM
+ TRACKER_ERR_BUNDLE_DOWNLOAD_TIMEOUT = iota + 1
+ TRACKER_ERR_BUNDLE_BAD_CHECKSUM
+ TRACKER_ERR_DEPLOYMENT_BAD_JSON
)
const (
- API_ERR_BAD_BLOCK = iota
+ API_ERR_BAD_BLOCK = iota + 1
API_ERR_BAD_JSON
- API_ERR_INVALID_CONTENT
+ API_ERR_BAD_CONTENT
API_ERR_INTERNAL
)
@@ -280,7 +280,7 @@
}
if errs.Len() > 0 {
- writeError(w, http.StatusBadRequest, API_ERR_INVALID_CONTENT, errs.String())
+ writeError(w, http.StatusBadRequest, API_ERR_BAD_CONTENT, errs.String())
return
}
diff --git a/bundle.go b/bundle.go
index e877ad2..197aff5 100644
--- a/bundle.go
+++ b/bundle.go
@@ -47,7 +47,7 @@
{
ID: dep.ID,
Status: RESPONSE_STATUS_FAIL,
- ErrorCode: TRACKER_ERR_INVALID_CHECKSUM,
+ ErrorCode: TRACKER_ERR_BUNDLE_BAD_CHECKSUM,
Message: msg,
},
})
@@ -132,7 +132,7 @@
{
ID: r.dep.ID,
Status: RESPONSE_STATUS_FAIL,
- ErrorCode: TRACKER_ERR_BUNDLE_TIMEOUT,
+ ErrorCode: TRACKER_ERR_BUNDLE_DOWNLOAD_TIMEOUT,
Message: "bundle download failed",
},
})
diff --git a/bundle_test.go b/bundle_test.go
index 15fd8e3..e2416f4 100644
--- a/bundle_test.go
+++ b/bundle_test.go
@@ -149,7 +149,7 @@
{
ID: deploymentID,
Status: RESPONSE_STATUS_FAIL,
- ErrorCode: TRACKER_ERR_BUNDLE_TIMEOUT,
+ ErrorCode: TRACKER_ERR_BUNDLE_DOWNLOAD_TIMEOUT,
Message: "bundle download failed",
},
}
@@ -174,7 +174,7 @@
Expect(d.ID).To(Equal(deploymentID))
Expect(d.DeployStatus).To(Equal(RESPONSE_STATUS_FAIL))
- Expect(d.DeployErrorCode).To(Equal(TRACKER_ERR_BUNDLE_TIMEOUT))
+ Expect(d.DeployErrorCode).To(Equal(TRACKER_ERR_BUNDLE_DOWNLOAD_TIMEOUT))
Expect(d.DeployErrorMessage).ToNot(BeEmpty())
Expect(d.LocalBundleURI).To(BeEmpty())
@@ -194,7 +194,7 @@
Expect(d.ID).To(Equal(deploymentID))
Expect(d.DeployStatus).To(Equal(RESPONSE_STATUS_FAIL))
- Expect(d.DeployErrorCode).To(Equal(TRACKER_ERR_BUNDLE_TIMEOUT))
+ Expect(d.DeployErrorCode).To(Equal(TRACKER_ERR_BUNDLE_DOWNLOAD_TIMEOUT))
Expect(d.DeployErrorMessage).ToNot(BeEmpty())
Expect(d.LocalBundleURI).To(BeAnExistingFile())
})
diff --git a/init.go b/init.go
index ff39a3e..98b9346 100644
--- a/init.go
+++ b/init.go
@@ -70,7 +70,7 @@
config.SetDefault(configBundleDirKey, "bundles")
config.SetDefault(configDebounceDuration, time.Second)
config.SetDefault(configBundleCleanupDelay, time.Minute)
- config.SetDefault(configMarkDeployFailedAfter, 10*time.Minute)
+ config.SetDefault(configMarkDeployFailedAfter, 5*time.Minute)
config.SetDefault(configDownloadConnTimeout, 5*time.Minute)
config.SetDefault(configConcurrentDownloads, 15)
config.SetDefault(configDownloadQueueSize, 2000)
diff --git a/listener.go b/listener.go
index 339213a..8c403bf 100644
--- a/listener.go
+++ b/listener.go
@@ -72,7 +72,7 @@
result := apiDeploymentResult{
ID: dep.ID,
Status: RESPONSE_STATUS_FAIL,
- ErrorCode: TRACKER_ERR_PARSE_FAILED,
+ ErrorCode: TRACKER_ERR_DEPLOYMENT_BAD_JSON,
Message: fmt.Sprintf("unable to parse deployment: %v", err),
}
errResults = append(errResults, result)
@@ -174,7 +174,7 @@
result := apiDeploymentResult{
ID: dep.ID,
Status: RESPONSE_STATUS_FAIL,
- ErrorCode: TRACKER_ERR_PARSE_FAILED,
+ ErrorCode: TRACKER_ERR_DEPLOYMENT_BAD_JSON,
Message: fmt.Sprintf("unable to parse deployment: %v", err),
}
errResults = append(errResults, result)