This repository has been archived by the owner on Dec 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #135 from HackIllinois/staging
Staging
- Loading branch information
Showing
71 changed files
with
2,212 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package errors | ||
|
||
import "net/http" | ||
|
||
// Used when the user attempts to perform an action that is not permitted as part of the flow. | ||
// E.g. Attempting to check-in without having RSVPed. | ||
func AttributeMismatchError(raw_error string, message string) ApiError { | ||
return ApiError{Status: http.StatusUnprocessableEntity, Type: "ATTRIBUTE_MISMATCH_ERROR", Message: message, RawError: raw_error} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package errors | ||
|
||
import "net/http" | ||
|
||
// An error that occurs when an incoming request comes without a JWT token in the Authorization header. | ||
func AuthorizationError(raw_error string, message string) ApiError { | ||
return ApiError{Status: http.StatusForbidden, Type: "AUTHORIZATION_ERROR", Message: message, RawError: raw_error} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package errors | ||
|
||
import "net/http" | ||
|
||
// An error that occurs when a database operation (e.g. fetch / insert / update) doesn't work. | ||
func DatabaseError(raw_error string, message string) ApiError { | ||
return ApiError{Status: http.StatusInternalServerError, Type: "DATABASE_ERROR", Message: message, RawError: raw_error} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package errors | ||
|
||
import "net/http" | ||
|
||
// Represents errors in the system, including failures in inter-service API calls. | ||
// If there are multiple possible sources of an error, we use this error. | ||
func InternalError(raw_error string, message string) ApiError { | ||
return ApiError{Status: http.StatusInternalServerError, Type: "INTERNAL_ERROR", Message: message, RawError: raw_error} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package errors | ||
|
||
import "net/http" | ||
|
||
// An error for when struct validation fails, or there are other issues with the payload to an endpoint. | ||
func MalformedRequestError(raw_error string, message string) ApiError { | ||
return ApiError{Status: http.StatusUnprocessableEntity, Type: "MALFORMED_REQUEST_ERROR", Message: message, RawError: raw_error} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package errors | ||
|
||
import "net/http" | ||
|
||
// Represents errors in the system whose cause is unidentified. | ||
func UnknownError(raw_error string, message string) ApiError { | ||
return ApiError{Status: http.StatusInternalServerError, Type: "UNKNOWN_ERROR", Message: message, RawError: raw_error} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
package errors | ||
|
||
type APIError struct { | ||
Status int `json:"status,omitempty"` | ||
Title string `json:"title,omitempty"` | ||
Message string `json:"message,omitempty"` | ||
/** | ||
* Status - the HTTP error code to be sent to the client - should be set by constructor | ||
* Type - the broad category - e.g. DatabaseError, AuthorizationError, InternalError | ||
* Message - provides additional details on the specific error that occurred. | ||
* RawError - the raw error (stringified) that caused the panic. It is only included in the response | ||
* to the client, if the config variable DEBUG_MODE is set to true. In other cases, the | ||
* field is set to the empty string, which causes its omission when encoded to JSON. | ||
**/ | ||
type ApiError struct { | ||
Status int `json:"status"` | ||
Type string `json:"type"` | ||
Message string `json:"message"` | ||
RawError string `json:"raw_error,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
"MAIL_SERVICE": "http://localhost:8009", | ||
"EVENT_SERVICE": "http://localhost:8010", | ||
"STAT_SERVICE": "http://localhost:8011", | ||
"NOTIFICATIONS_SERVICE": "http://localhost:8012", | ||
|
||
"GATEWAY_PORT": "8000", | ||
"AUTH_PORT": ":8002", | ||
|
@@ -21,6 +22,7 @@ | |
"MAIL_PORT": ":8009", | ||
"EVENT_PORT": ":8010", | ||
"STAT_PORT": ":8011", | ||
"NOTIFICATIONS_PORT": ":8012", | ||
|
||
"AUTH_DB_HOST": "localhost", | ||
"USER_DB_HOST": "localhost", | ||
|
@@ -32,6 +34,7 @@ | |
"MAIL_DB_HOST": "localhost", | ||
"EVENT_DB_HOST": "localhost", | ||
"STAT_DB_HOST": "localhost", | ||
"NOTIFICATIONS_DB_HOST": "localhost", | ||
|
||
"AUTH_DB_NAME": "auth", | ||
"USER_DB_NAME": "user", | ||
|
@@ -43,10 +46,16 @@ | |
"MAIL_DB_NAME": "mail", | ||
"EVENT_DB_NAME": "event", | ||
"STAT_DB_NAME": "stat", | ||
"NOTIFICATIONS_DB_NAME": "notifications", | ||
|
||
"S3_REGION": "us-east-1", | ||
"S3_BUCKET": "hackillinois-upload-2019", | ||
|
||
"SNS_REGION": "us-east-1", | ||
|
||
"ANDROID_PLATFORM_ARN": "", | ||
"IOS_PLATFORM_ARN": "", | ||
|
||
"STAFF_DOMAIN": "hackillinois.org", | ||
"SYSTEM_ADMIN_EMAIL": "[email protected]", | ||
|
||
|
@@ -65,6 +74,8 @@ | |
|
||
"IS_PRODUCTION": "false", | ||
|
||
"DEBUG_MODE": "true", | ||
|
||
"DECISION_EXPIRATION_HOURS": "48", | ||
|
||
"STAT_ENDPOINTS": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
"MAIL_PORT": ":8009", | ||
"EVENT_PORT": ":8010", | ||
"STAT_PORT": ":8011", | ||
"NOTIFICATIONS_PORT": ":8012", | ||
|
||
"AUTH_DB_NAME": "auth", | ||
"USER_DB_NAME": "user", | ||
|
@@ -32,10 +33,13 @@ | |
"MAIL_DB_NAME": "mail", | ||
"EVENT_DB_NAME": "event", | ||
"STAT_DB_NAME": "stat", | ||
"NOTIFICATIONS_DB_NAME": "notifications", | ||
|
||
"S3_REGION": "us-east-1", | ||
"S3_BUCKET": "hackillinois-upload-2019", | ||
|
||
"SNS_REGION": "us-east-1", | ||
|
||
"STAFF_DOMAIN": "hackillinois.org", | ||
"SYSTEM_ADMIN_EMAIL": "[email protected]", | ||
|
||
|
@@ -44,6 +48,8 @@ | |
|
||
"IS_PRODUCTION": "true", | ||
|
||
"DEBUG_MODE": "false", | ||
|
||
"DECISION_EXPIRATION_HOURS": "48", | ||
|
||
"STAT_ENDPOINTS": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
"MAIL_PORT": ":8009", | ||
"EVENT_PORT": ":8010", | ||
"STAT_PORT": ":8011", | ||
"NOTIFICATIONS_PORT": ":8012", | ||
|
||
"AUTH_DB_HOST": "localhost", | ||
"USER_DB_HOST": "localhost", | ||
|
@@ -32,6 +33,7 @@ | |
"MAIL_DB_HOST": "localhost", | ||
"EVENT_DB_HOST": "localhost", | ||
"STAT_DB_HOST": "localhost", | ||
"NOTIFICATIONS_DB_HOST": "localhost", | ||
|
||
"AUTH_DB_NAME": "test-auth", | ||
"USER_DB_NAME": "test-user", | ||
|
@@ -43,10 +45,16 @@ | |
"MAIL_DB_NAME": "test-mail", | ||
"EVENT_DB_NAME": "test-event", | ||
"STAT_DB_NAME": "test-stat", | ||
"NOTIFICATIONS_DB_NAME": "test-notifications", | ||
|
||
"S3_REGION": "us-east-1", | ||
"S3_BUCKET": "hackillinois-upload-2019", | ||
|
||
"SNS_REGION": "us-east-1", | ||
|
||
"ANDROID_PLATFORM_ARN": "", | ||
"IOS_PLATFORM_ARN": "", | ||
|
||
"STAFF_DOMAIN": "hackillinois.org", | ||
"SYSTEM_ADMIN_EMAIL": "[email protected]", | ||
|
||
|
@@ -65,6 +73,8 @@ | |
|
||
"IS_PRODUCTION": "false", | ||
|
||
"DEBUG_MODE": "true", | ||
|
||
"DECISION_EXPIRATION_HOURS": "48", | ||
|
||
"STAT_ENDPOINTS": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.