-
Notifications
You must be signed in to change notification settings - Fork 0
Errorhelper
This serves as an Errorhandler and also provides the log method used within the project.
Takes a http.ResponseWriter and a pointer to a http.Request. This funtion will send an error message to the client with the http.ResponseWriter informing them that they will have to connect to /ws
.
It does not return a value
Sample Usage:
ErrorHelper.InvalidRouteError(resp, req)
Takes a http.ResponseWriter and a pointer to a http.Request. This funtion will send an error message to the client with the http.ResponseWriter informing them that they will have to connect to via websocket. It will also inform them that the http(s) endpoint of speedrun.io is under a different domain.
It does not return a value.
Sample Usage:
ErrorHelper.ConnectionNotWebsocketError(resp, req)
This is the log function of the server. Depending on the mode provided it will color the output accordingly or leave it at the system default if no valid mode was provided.
It takes two strings, one representing the mode and the second being the message itself.
It does not return a value.
Currently features modes are:
- Error - output is red
- Warning - output is yellow
- Update - output is green
Sample Usage of the command:
OutputToConsole("Error", "Something failed horribly)