Skip to content

Commit 1659b44

Browse files
committed
fix(be): remove extra panic and use correct obj to type detection
1 parent f0adad5 commit 1659b44

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

api/login.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,12 @@ func createSession(w http.ResponseWriter, r *http.Request, user db.User, oidc bo
203203
"session": newSession.ID,
204204
})
205205
if err != nil {
206-
panic(err)
206+
log.WithError(err).WithFields(log.Fields{
207+
"user_id": user.ID,
208+
"context": "session",
209+
}).Error("Failed to encode session cookie")
210+
helpers.WriteErrorStatus(w, "Failed to create session", http.StatusInternalServerError)
211+
return
207212
}
208213

209214
http.SetCookie(w, &http.Cookie{

db/sql/SqlDb.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ func (d *SqlDb) CreateObject(props db.ObjectProps, object any) (newObject any, e
771771
return
772772
}
773773

774-
template, args := InsertTemplateFromType(newObject)
774+
template, args := InsertTemplateFromType(object)
775775
insertID, err := d.insert(
776776
"id",
777777
"insert into "+props.TableName+" "+template, args...)

0 commit comments

Comments
 (0)