fix: add error logging to empty catch blocks

This commit is contained in:
Kirill
2026-05-27 20:17:05 +05:00
parent 8f3bd7aa3b
commit f6414adf2f
26 changed files with 1590 additions and 34 deletions
+2 -1
View File
@@ -17,7 +17,8 @@ apiClient.interceptors.request.use((config) => {
config.headers.delete('content-type')
}
return config
} catch {
} catch (err) {
console.warn('[api-client] Failed to set auth token', err)
return config
}
})
@@ -12,7 +12,8 @@ export function parseOrderAddressSnapshot(json: string | null | undefined): Orde
if (!json) return null
try {
return JSON.parse(json) as OrderAddressSnapshot
} catch {
} catch (err) {
console.warn('[order-address-snapshot] Failed to parse address snapshot', err)
return null
}
}
+6 -5
View File
@@ -3,7 +3,8 @@ const TOKEN_KEY = 'craftshop_auth_token'
export function readStoredToken(): string | null {
try {
return localStorage.getItem(TOKEN_KEY)
} catch {
} catch (err) {
console.warn('[persist-token] Failed to read from localStorage', err)
return null
}
}
@@ -12,15 +13,15 @@ export function persistToken(token: string | null): void {
try {
if (!token) localStorage.removeItem(TOKEN_KEY)
else localStorage.setItem(TOKEN_KEY, token)
} catch {
// ignore
} catch (err) {
console.warn('[persist-token] Failed to write to localStorage', err)
}
}
export function removeStoredToken(): void {
try {
localStorage.removeItem(TOKEN_KEY)
} catch {
// ignore
} catch (err) {
console.warn('[persist-token] Failed to remove from localStorage', err)
}
}
+4 -3
View File
@@ -10,7 +10,8 @@ const STORAGE_KEY = 'cookie-consent-accepted'
function wasAccepted(): boolean {
try {
return localStorage.getItem(STORAGE_KEY) === '1'
} catch {
} catch (err) {
console.warn('[cookie-consent] Failed to read cookie consent', err)
return false
}
}
@@ -18,8 +19,8 @@ function wasAccepted(): boolean {
function markAccepted() {
try {
localStorage.setItem(STORAGE_KEY, '1')
} catch {
// ignore
} catch (err) {
console.warn('[cookie-consent] Failed to persist cookie consent', err)
}
}
@@ -22,8 +22,8 @@ export function RichTextMessageContent({ value, tone = 'default' }: RichTextMess
const normalizedValue = value.trim() ? value : '<p></p>'
try {
if (editor.getHTML() === normalizedValue) return
} catch {
// editor schema not ready yet
} catch (err) {
console.warn('[tiptap] Failed to get editor HTML', err)
return
}
editor.commands.setContent(normalizedValue, { emitUpdate: false })