forked from kubeedge/kubeedge
-
Notifications
You must be signed in to change notification settings - Fork 7
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 #16 from pf93/feature-keruntime-monitor-edge-app
MIKU-40 Feature keruntime monitor edge app
- Loading branch information
Showing
5 changed files
with
67 additions
and
26 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,31 @@ | ||
package model | ||
|
||
import "fmt" | ||
|
||
type Error struct { | ||
Status int `json:"-"` | ||
Code string `json:"code"` | ||
Message string `json:"msg"` | ||
} | ||
|
||
func (e *Error) Error() string { | ||
return fmt.Sprintf("error:status=%v code=%s, message=%s", e.Status, e.Code, e.Message) | ||
} | ||
|
||
func New(status int, code, message string) *Error { | ||
return &Error{ | ||
Status: status, | ||
Code: code, | ||
Message: message, | ||
} | ||
} | ||
|
||
var ( | ||
Success = New(200, "1000", "Success") | ||
ErrInvalidParam = New(400, "1002", "Invalid parameter") | ||
ErrCertEmpty = New(403, "1112", "Domain has no cert") | ||
ErrRequestMethod = New(405, "1113", "Request method error") | ||
ErrInternalServer = New(500, "1001", "Internal server error") | ||
ErrJsonUnmarshal = New(500, "1107", "Json unmarshal error") | ||
ErrFormatResponse = New(500, "1108", "Format http response 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
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