mirror of
https://github.com/umami-software/umami.git
synced 2025-12-06 01:18:00 +01:00
Handle unique session errors.
This commit is contained in:
parent
2a2ce0e98d
commit
56cf55e053
1 changed files with 16 additions and 10 deletions
|
|
@ -37,16 +37,22 @@ export async function getSession(req) {
|
|||
let session = await getSessionByUuid(session_uuid);
|
||||
|
||||
if (!session) {
|
||||
session = await createSession(website_id, {
|
||||
session_uuid,
|
||||
hostname,
|
||||
browser,
|
||||
os,
|
||||
screen,
|
||||
language,
|
||||
country,
|
||||
device,
|
||||
});
|
||||
try {
|
||||
session = await createSession(website_id, {
|
||||
session_uuid,
|
||||
hostname,
|
||||
browser,
|
||||
os,
|
||||
screen,
|
||||
language,
|
||||
country,
|
||||
device,
|
||||
});
|
||||
} catch (e) {
|
||||
if (!e.message.includes('Unique constraint')) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const { session_id } = session;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue