Implement parsing browser requests and sending errors (#9)

This commit is contained in:
Maxim Baz
2018-04-14 12:49:03 +02:00
committed by GitHub
parent 60a4a1ddaa
commit 42e6157238
10 changed files with 192 additions and 28 deletions

26
errors/errors.go Normal file
View 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))
}