Compare commits

...

41 commits

Author SHA1 Message Date
kim ddf4fb9efa panics get logged at error level, now include stacktrace
Signed-off-by: kim <grufwub@gmail.com>
2022-07-08 08:42:10 +01:00
kim 3fb5890f3a Merge remote-tracking branch 'upstream/main' 2022-07-05 10:52:49 +01:00
kim 5d448c9ce8 Merge remote-tracking branch 'upstream/main' 2022-06-30 12:41:16 +01:00
kim c6af3b3cff Merge remote-tracking branch 'upstream/main' 2022-06-22 11:38:04 +01:00
kim 89f042aecd Merge remote-tracking branch 'origin/main' 2022-06-14 17:15:17 +01:00
kim 5d5135b907 Merge remote-tracking branch 'upstream/main' 2022-06-11 10:10:50 +01:00
kim c4682d19f9 Merge remote-tracking branch 'upstream/validate/set-accountDomain' 2022-06-11 09:56:00 +01:00
tsmethurst c4a223b7b7 fix broken test 2022-06-11 10:48:14 +02:00
tsmethurst 54d9778c4c Merge branch 'main' into webfinger_rework 2022-06-11 10:44:00 +02:00
tsmethurst 7bfcc5f505 skip long search if local account 2022-06-02 17:08:15 +02:00
tsmethurst 8ac9001df2 simplify GetParseMentionFunc 2022-06-02 17:07:59 +02:00
tsmethurst 5e993f6799 add more extraction tests 2022-06-02 17:07:29 +02:00
tsmethurst c53226cf99 be more permissive in namestring lookup 2022-06-02 16:39:48 +02:00
tsmethurst 5fc230710d final search for discovered accountDomain 2022-06-02 16:38:44 +02:00
tsmethurst 2edc5c702a don't repeat regex parsing 2022-06-02 16:38:30 +02:00
tsmethurst d2c512575c increase default worker count to 4 per cpu 2022-06-02 15:52:12 +02:00
tsmethurst c1f225f373 test webfinger part extraction 2022-06-02 13:39:16 +02:00
tsmethurst 61a8d97bc3 don't finger instance accounts 2022-06-02 13:39:08 +02:00
tsmethurst 2f1b638357 update mentionName regex
recognize instance accounts
2022-06-02 13:38:56 +02:00
tsmethurst c0ab7f5d69 cheeky linting with the lads 2022-06-02 12:56:21 +02:00
tsmethurst bbe2985d9b webfinger only if necessary 2022-06-02 12:38:59 +02:00
tsmethurst 49490d8999 fix up tests to use main mock httpclient 2022-06-02 12:38:39 +02:00
tsmethurst 181f782d13 break a lot of tests
Move shared test logic into the testrig,
rather than having it scattered all over
the place. This allows us to just mock
the transport controller once, and have
all tests use it (unless they need not to
for some other reason).
2022-06-01 18:13:16 +02:00
tsmethurst 1a3f974223 start updating tests to remove repetition 2022-06-01 16:11:02 +02:00
tsmethurst 098aa4f781 rework GetRemoteAccount 2022-06-01 16:10:41 +02:00
tsmethurst aaeef76ceb fix for new getRemoteAccount 2022-06-01 16:10:28 +02:00
tsmethurst f34844850c fix incorrect debug call 2022-06-01 16:07:44 +02:00
tsmethurst 997e6f6c06 use new ASRepToAccount signature 2022-06-01 11:50:46 +02:00
tsmethurst b23fdac317 remove refresh from account 2022-06-01 11:50:30 +02:00
tsmethurst 3de882a255 just a real nasty commit, the worst 2022-05-31 16:58:08 +02:00
tsmethurst a4c64bd56d rework finger again, final form 2022-05-31 16:57:43 +02:00
tsmethurst 124ff8ca0b use accountDomain 2022-05-31 16:57:32 +02:00
tsmethurst 8ffb1a8845 use util function to extract webfinger parts 2022-05-31 12:26:55 +02:00
tsmethurst e8a65b9675 rework webfingerget 2022-05-31 12:26:40 +02:00
tsmethurst 863231cc97 move mention parts to namestring 2022-05-31 12:26:31 +02:00
tsmethurst c746b00731 start reworking getRemoteAccount a bit 2022-05-30 18:45:38 +02:00
tsmethurst af018e42c0 start reworking finger func a bit 2022-05-30 18:45:25 +02:00
tsmethurst 6a9b6afdf3 totally break GetRemoteAccount 2022-05-30 16:20:10 +02:00
tsmethurst 95b6c1b866 move finger to dereferencer 2022-05-30 16:19:52 +02:00
tsmethurst b0299d2343 set/validate accountDomain 2022-05-30 15:30:58 +02:00
tsmethurst c089a04183 add miekg/dns dependency 2022-05-30 15:30:38 +02:00

View file

@ -22,6 +22,7 @@ import (
"context"
"net/http"
"codeberg.org/gruf/go-errors/v2"
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"
apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model"
@ -107,7 +108,14 @@ func ErrorHandler(c *gin.Context, errWithCode gtserror.WithCode, instanceGet fun
// we should still try to return a basic code
defer func() {
if p := recover(); p != nil {
l.Warnf("recovered from panic: %s", p)
// Fetch stacktrace up to this point
callers := errors.GetCallers(3, 10)
// Log this panic to the standard log
l = l.WithField("stacktrace", callers)
l.Errorf("recovered from panic: %v", p)
// Respond with determined error code
c.JSON(statusCode, gin.H{"error": errWithCode.Safe()})
}
}()