Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1ea04f1577 | ||
|
|
17fd3c60f8 | ||
|
|
c5b62a42db |
@@ -75,11 +75,10 @@ func queryHandler() http.HandlerFunc {
|
|||||||
handler := handler.GraphQL(
|
handler := handler.GraphQL(
|
||||||
graph2.New(),
|
graph2.New(),
|
||||||
handler.RecoverFunc(func(ctx context.Context, err interface{}) error {
|
handler.RecoverFunc(func(ctx context.Context, err interface{}) error {
|
||||||
// send this panic somewhere
|
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
log.Println(string(debug.Stack()))
|
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")
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -125,10 +125,10 @@ func (r *mutationResolver) ImportLog(ctx context.Context, input input.LogImportI
|
|||||||
|
|
||||||
newLogs := make([]models.Log, 0, len(results))
|
newLogs := make([]models.Log, 0, len(results))
|
||||||
for _, result := range 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("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)
|
changes.Submit("Post", "add", token.UserID, true, changekeys.Many(result.Log, result.Posts), result.Posts)
|
||||||
}()
|
}(result)
|
||||||
|
|
||||||
log, err := logs.UpdateCharacters(result.Log, nil)
|
log, err := logs.UpdateCharacters(result.Log, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -52,6 +52,9 @@ func ParsePost(line string, date time.Time, prev models.Post) (models.Post, erro
|
|||||||
|
|
||||||
if line[tsEndIndex+2] == '*' {
|
if line[tsEndIndex+2] == '*' {
|
||||||
split := strings.SplitN(line[tsEndIndex+4:], " ", 2)
|
split := strings.SplitN(line[tsEndIndex+4:], " ", 2)
|
||||||
|
if len(split) == 1 {
|
||||||
|
return models.Post{}, ErrNotPost
|
||||||
|
}
|
||||||
|
|
||||||
post := models.Post{
|
post := models.Post{
|
||||||
ID: "UNASSIGNED",
|
ID: "UNASSIGNED",
|
||||||
@@ -70,6 +73,9 @@ func ParsePost(line string, date time.Time, prev models.Post) (models.Post, erro
|
|||||||
return post, nil
|
return post, nil
|
||||||
} else if line[tsEndIndex+2] == '<' {
|
} else if line[tsEndIndex+2] == '<' {
|
||||||
split := strings.SplitN(line[tsEndIndex+2:], " ", 2)
|
split := strings.SplitN(line[tsEndIndex+2:], " ", 2)
|
||||||
|
if len(split) == 1 {
|
||||||
|
return models.Post{}, ErrNotPost
|
||||||
|
}
|
||||||
|
|
||||||
post := models.Post{
|
post := models.Post{
|
||||||
ID: "UNASSIGNED",
|
ID: "UNASSIGNED",
|
||||||
|
|||||||
@@ -71,6 +71,10 @@ func TestParsePostErrors(t *testing.T) {
|
|||||||
{"[10] <Stuff> Things said.", mirclike.ErrNotPost},
|
{"[10] <Stuff> Things said.", mirclike.ErrNotPost},
|
||||||
{"[12:34:56:789] <Stuff> Things said.", nil},
|
{"[12:34:56:789] <Stuff> Things said.", nil},
|
||||||
{"[12:34:56.789] <Stuff> Things said.", mirclike.ErrNotPost},
|
{"[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 {
|
for i, row := range table {
|
||||||
|
|||||||
Reference in New Issue
Block a user