mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-23 14:53:34 +01:00
remove panics - that is not a exception replacement
This commit is contained in:
parent
b27460d3fe
commit
c2a42587d2
1 changed files with 4 additions and 3 deletions
|
@ -249,7 +249,7 @@ func RepositoryInbox(ctx *context.APIContext) {
|
||||||
ctx.ServerError("Validate actorId", err)
|
ctx.ServerError("Validate actorId", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Info("RepositoryInbox: actorId parsed: %v", actorId)
|
log.Info("RepositoryInbox: actorId validated: %v", actorId)
|
||||||
// parse objectId (repository)
|
// parse objectId (repository)
|
||||||
objectId, err := forgefed.NewRepositoryId(activity.Object.GetID().String(), string(activity.Source))
|
objectId, err := forgefed.NewRepositoryId(activity.Object.GetID().String(), string(activity.Source))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -260,7 +260,7 @@ func RepositoryInbox(ctx *context.APIContext) {
|
||||||
ctx.ServerError("Validate objectId", err)
|
ctx.ServerError("Validate objectId", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.Info("RepositoryInbox: objectId parsed: %v", objectId)
|
log.Info("RepositoryInbox: objectId validated: %v", objectId)
|
||||||
|
|
||||||
adctorAsWebfinger := actorId.AsWebfinger() // used as LoginName in newly created user
|
adctorAsWebfinger := actorId.AsWebfinger() // used as LoginName in newly created user
|
||||||
log.Info("remotStargazer: %v", adctorAsWebfinger)
|
log.Info("remotStargazer: %v", adctorAsWebfinger)
|
||||||
|
@ -268,7 +268,8 @@ func RepositoryInbox(ctx *context.APIContext) {
|
||||||
// Check if user already exists
|
// Check if user already exists
|
||||||
users, err := SearchUsersByLoginName(adctorAsWebfinger)
|
users, err := SearchUsersByLoginName(adctorAsWebfinger)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(fmt.Errorf("searching for user failed: %v", err))
|
ctx.ServerError(fmt.Sprintf("Searching for user failed: %v"), err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
switch len(users) {
|
switch len(users) {
|
||||||
|
|
Loading…
Reference in a new issue