Compare commits

...
3 Commits
Author SHA1 Message Date
gisle 1ea04f1577 importers: Fixed panic in mirclike.ParsePost if the post contains no text.
the build was successful
2019-01-05 10:33:50 +01:00
gisle 17fd3c60f8 rpdata-server: Fixed unhelpful error message being returned on panic.
the build was successful
2019-01-05 10:09:31 +01:00
gisle c5b62a42db graph2: Fixed data race in change logging for importLog.
the build was successful
2018-12-11 20:05:03 +01:00
4 changed files with 13 additions and 4 deletions
+1 -2
View File
@@ -75,11 +75,10 @@ func queryHandler() http.HandlerFunc {
handler := handler.GraphQL(
graph2.New(),
handler.RecoverFunc(func(ctx context.Context, err interface{}) error {
// send this panic somewhere
log.Println(err)
log.Println(string(debug.Stack()))
return fmt.Errorf("shit")
return fmt.Errorf("The server failed to serve your request due to an internal error, it has been logged")
}),
)
+2 -2
View File
@@ -125,10 +125,10 @@ func (r *mutationResolver) ImportLog(ctx context.Context, input input.LogImportI
newLogs := make([]models.Log, 0, len(results))
for _, result := range results {
go func() {
go func(result logs.ImportedLog) {
changes.Submit("Log", "add", token.UserID, true, changekeys.Many(result.Log), result.Log)
changes.Submit("Post", "add", token.UserID, true, changekeys.Many(result.Log, result.Posts), result.Posts)
}()
}(result)
log, err := logs.UpdateCharacters(result.Log, nil)
if err != nil {
+6
View File
@@ -52,6 +52,9 @@ func ParsePost(line string, date time.Time, prev models.Post) (models.Post, erro
if line[tsEndIndex+2] == '*' {
split := strings.SplitN(line[tsEndIndex+4:], " ", 2)
if len(split) == 1 {
return models.Post{}, ErrNotPost
}
post := models.Post{
ID: "UNASSIGNED",
@@ -70,6 +73,9 @@ func ParsePost(line string, date time.Time, prev models.Post) (models.Post, erro
return post, nil
} else if line[tsEndIndex+2] == '<' {
split := strings.SplitN(line[tsEndIndex+2:], " ", 2)
if len(split) == 1 {
return models.Post{}, ErrNotPost
}
post := models.Post{
ID: "UNASSIGNED",
+4
View File
@@ -71,6 +71,10 @@ func TestParsePostErrors(t *testing.T) {
{"[10] <Stuff> Things said.", mirclike.ErrNotPost},
{"[12:34:56:789] <Stuff> Things said.", nil},
{"[12:34:56.789] <Stuff> Things said.", mirclike.ErrNotPost},
{"[12:34] <Stuff>", mirclike.ErrNotPost},
{"[12:34] * Stuff", mirclike.ErrNotPost},
{"[12:34] =Scene=", mirclike.ErrNotPost},
{"[12:34] <=Scene=>", mirclike.ErrNotPost},
}
for i, row := range table {