aboutsummaryrefslogtreecommitdiff
path: root/api/const.go
diff options
context:
space:
mode:
authorjloup <jeanloup.jamet@gmail.com>2018-02-22 11:31:59 +0100
committerjloup <jeanloup.jamet@gmail.com>2018-02-22 11:31:59 +0100
commit2f91f20a8645339385ada602684f4957f20f4da4 (patch)
treea084cf293af15cc6ea6a1417edad51fcf0674947 /api/const.go
parent3602fbf8412d69900d793a963c8e774f487f5e45 (diff)
downloadFront-2f91f20a8645339385ada602684f4957f20f4da4.tar.gz
Front-2f91f20a8645339385ada602684f4957f20f4da4.tar.zst
Front-2f91f20a8645339385ada602684f4957f20f4da4.zip
Poloniex connection.
Diffstat (limited to 'api/const.go')
-rw-r--r--api/const.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/api/const.go b/api/const.go
index 2edd6f4..1b22355 100644
--- a/api/const.go
+++ b/api/const.go
@@ -6,15 +6,19 @@ import "net/http"
6type Status uint32 6type Status uint32
7type ErrorCode uint32 7type ErrorCode uint32
8 8
9const EXTERNAL_SERVICE_TIMEOUT_SECONDS = 10
10
9const ( 11const (
10 OK Status = iota 12 OK Status = iota
11 NOK 13 NOK
12 14
13 BadRequest ErrorCode = iota + 1 15 BadRequest ErrorCode = iota + 1
14 EmailExists 16 EmailExists
17 ExternalServiceTimeout
15 InternalError 18 InternalError
16 InvalidCredentials 19 InvalidCredentials
17 InvalidEmail 20 InvalidEmail
21 InvalidMarketCredentials
18 InvalidOtp 22 InvalidOtp
19 InvalidPassword 23 InvalidPassword
20 NeedOtpValidation 24 NeedOtpValidation
@@ -31,7 +35,7 @@ func StatusToHttpCode(status Status, code ErrorCode) int {
31 } 35 }
32 36
33 switch code { 37 switch code {
34 case BadRequest, InvalidPassword, InvalidEmail: 38 case BadRequest, InvalidPassword, InvalidEmail, InvalidMarketCredentials:
35 return http.StatusBadRequest 39 return http.StatusBadRequest
36 40
37 case InvalidCredentials, InvalidOtp: 41 case InvalidCredentials, InvalidOtp:
@@ -45,6 +49,9 @@ func StatusToHttpCode(status Status, code ErrorCode) int {
45 49
46 case NotFound: 50 case NotFound:
47 return http.StatusNotFound 51 return http.StatusNotFound
52
53 case ExternalServiceTimeout:
54 return http.StatusGatewayTimeout
48 } 55 }
49 56
50 return http.StatusInternalServerError 57 return http.StatusInternalServerError