Added crash filtering
Added version field to individual crash
This commit is contained in:
@@ -14,10 +14,11 @@ type ArchivedCrash struct {
|
||||
}
|
||||
|
||||
type IndividualCrash struct {
|
||||
Platform string `json:"platform" bson:"platform"`
|
||||
Error string `json:"error" bson:"error"`
|
||||
Stack string `json:"stack" bson:"stack"`
|
||||
Count int `json:"count" bson:"count"`
|
||||
Platform string `json:"platform" bson:"platform"`
|
||||
AppVersion string `json:"appVersion" bson:"appVersion"`
|
||||
Error string `json:"error" bson:"error"`
|
||||
Stack string `json:"stack" bson:"stack"`
|
||||
Count int `json:"count" bson:"count"`
|
||||
}
|
||||
|
||||
type CrashReport struct {
|
||||
@@ -43,10 +44,15 @@ func (b *Backend) reportCrash(w http.ResponseWriter, r *http.Request) {
|
||||
defer r.Body.Close()
|
||||
var crash IndividualCrash
|
||||
err = json.NewDecoder(r.Body).Decode(&crash)
|
||||
if err != nil || crash.Platform == "" || crash.Error == "" || crash.Stack == "" {
|
||||
if err != nil || crash.Platform == "" || crash.AppVersion == "" || crash.Error == "" || crash.Stack == "" {
|
||||
ReturnError(w, http.StatusBadRequest, "invalidBody", "Bad request")
|
||||
return
|
||||
}
|
||||
if filter, ok := ap.(CrashFilterApp); ok {
|
||||
if !filter.AddCrash(crash) {
|
||||
return
|
||||
}
|
||||
}
|
||||
tab := ap.CrashTable()
|
||||
if tab == nil {
|
||||
log.Printf("key %v has crash permission, but app does not have a crash table", hdr.Key.AppID)
|
||||
@@ -60,8 +66,8 @@ func (b *Backend) reportCrash(w http.ResponseWriter, r *http.Request) {
|
||||
ReturnError(w, http.StatusInternalServerError, "internal", "Server error")
|
||||
return
|
||||
}
|
||||
w.WriteHeader(http.StatusCreated)
|
||||
}
|
||||
w.WriteHeader(http.StatusCreated)
|
||||
}
|
||||
|
||||
func (b *Backend) deleteCrash(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
Reference in New Issue
Block a user