Implement parsing browser requests and sending errors (#9)
This commit is contained in:
26
errors/errors.go
Normal file
26
errors/errors.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package errors
|
||||
|
||||
import (
|
||||
"os"
|
||||
)
|
||||
|
||||
// Code exit code
|
||||
type Code int
|
||||
|
||||
// Error codes that are sent to the browser extension and used as exit codes in the app.
|
||||
// DO NOT MODIFY THE VALUES, always append new error codes to the bottom.
|
||||
const (
|
||||
// CodeParseRequestLength error parsing request length
|
||||
CodeParseRequestLength Code = 10
|
||||
|
||||
// CodeParseRequest error parsing request
|
||||
CodeParseRequest Code = 11
|
||||
|
||||
// CodeInvalidRequestAction error parsing request action
|
||||
CodeInvalidRequestAction = 12
|
||||
)
|
||||
|
||||
// ExitWithCode exit with error code
|
||||
func ExitWithCode(code Code) {
|
||||
os.Exit(int(code))
|
||||
}
|
Reference in New Issue
Block a user