mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-18 15:23:38 +01:00
Handle unique session errors.
This commit is contained in:
parent
2a2ce0e98d
commit
56cf55e053
@ -37,16 +37,22 @@ export async function getSession(req) {
|
|||||||
let session = await getSessionByUuid(session_uuid);
|
let session = await getSessionByUuid(session_uuid);
|
||||||
|
|
||||||
if (!session) {
|
if (!session) {
|
||||||
session = await createSession(website_id, {
|
try {
|
||||||
session_uuid,
|
session = await createSession(website_id, {
|
||||||
hostname,
|
session_uuid,
|
||||||
browser,
|
hostname,
|
||||||
os,
|
browser,
|
||||||
screen,
|
os,
|
||||||
language,
|
screen,
|
||||||
country,
|
language,
|
||||||
device,
|
country,
|
||||||
});
|
device,
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
if (!e.message.includes('Unique constraint')) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const { session_id } = session;
|
const { session_id } = session;
|
||||||
|
Loading…
Reference in New Issue
Block a user