From 5cf7dc8ee6cf2c22995071888a20ef2a53427b11 Mon Sep 17 00:00:00 2001 From: Razvan Date: Sun, 7 Apr 2024 03:15:10 +0200 Subject: [PATCH] chore(app): updating error management --- bun.lockb | Bin 232891 -> 232891 bytes package.json | 4 ++-- src/lib/session.js | 50 ++++++++++++++++++++++----------------------- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/bun.lockb b/bun.lockb index ca177fa209b384d642cb6133d53e169cbe50a525..bf75ea6e2e89e1d1aa4a8c053688b4b0d68f3716 100755 GIT binary patch delta 155 zcmV;M0A&BWn-0614v;P&!UTo;ZqWWXx_V-ZL$nijLZ6{JKw7s?ka%x>*x+Vju}-Ei zle9TBvnVkwxtD&krn7@(NPEbsP%)D>$jEb0hW0IGPf*c0tW&CGPg8m0?vn*@>~NV Jw$jEb0hW0IF}Eyb0tW&CF}E~l0?vn*67T{d Jw>} Error if no session with the given `id` is found, otherwise success. */ async destroy({ id }) { - const getAttempt = await _interface.get(id) - if (getAttempt.error) { - return error(getAttempt.error) + const [getValue, getError] = await _interface.get(id) + if (getError) { + return error(getError) } - const session = getAttempt.value + const session = getValue if (!session) { return error(`Session ${id} not found.`) } - const deleteAttempt = await _interface.delete(id) - if (deleteAttempt.error) { - return error(deleteAttempt.error) + const [, deleteError] = await _interface.delete(id) + if (deleteError) { + return error(deleteError) } return ok()