Clarify log error with a '[Pocketbase]' prefix

This commit is contained in:
BlackSigkill 2026-02-05 12:19:21 +01:00
parent 679a405d41
commit 8e9ffaa694

View file

@ -18,10 +18,8 @@ const syncManager = {
_isSyncing: false, _isSyncing: false,
async _getUserRecord(uid) { async _getUserRecord(uid) {
if (!uid) { if (!uid) return null;
console.warn('_getUserRecord called with no UID.');
return null;
}
if (this._userRecordCache && this._userRecordCache.firebase_id === uid) { if (this._userRecordCache && this._userRecordCache.firebase_id === uid) {
return this._userRecordCache; return this._userRecordCache;
} }
@ -46,11 +44,11 @@ const syncManager = {
this._userRecordCache = newRecord; this._userRecordCache = newRecord;
return newRecord; return newRecord;
} catch (createError) { } catch (createError) {
console.error('Failed to create user record in PocketBase:', createError); console.error('[PocketBase] Failed to create user:', createError);
return null; return null;
} }
} }
console.error('Failed to get user record from PocketBase:', error); console.error('[PocketBase] Failed to get user:', error);
return null; return null;
} }
}, },
@ -567,10 +565,10 @@ const syncManager = {
window.dispatchEvent(new CustomEvent('history-changed')); window.dispatchEvent(new CustomEvent('history-changed'));
window.dispatchEvent(new HashChangeEvent('hashchange')); window.dispatchEvent(new HashChangeEvent('hashchange'));
console.log('[PocketBase] ✓ Sync completed successfully'); console.log('[PocketBase] ✓ Sync completed');
} }
} catch (error) { } catch (error) {
console.error('Error during PocketBase sync!', error); console.error('[PocketBase] Sync error:', error);
} finally { } finally {
this._isSyncing = false; this._isSyncing = false;
} }