refactor: Remove console logging for error handling in useMarket and useMarketPreloader
- Eliminate console.log and console.warn statements to enhance code clarity and maintainability. - Replace error logging with comments to silently handle errors during market, stall, and product loading processes. - Streamline the preloading process by removing unnecessary logging, improving overall code readability.
This commit is contained in:
parent
786e27ab61
commit
06bcc4b91e
3 changed files with 11 additions and 47 deletions
|
|
@ -57,7 +57,6 @@ export function useMarket() {
|
|||
|
||||
} catch (err) {
|
||||
error.value = err instanceof Error ? err : new Error('Failed to load market')
|
||||
console.error('Error loading market:', err)
|
||||
throw err
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
|
|
@ -115,7 +114,6 @@ export function useMarket() {
|
|||
}
|
||||
|
||||
} catch (err) {
|
||||
console.error('Error loading market data:', err)
|
||||
// Don't throw error, create default market instead
|
||||
const market = {
|
||||
d: marketData.identifier,
|
||||
|
|
@ -141,7 +139,6 @@ export function useMarket() {
|
|||
// Get the active market to filter by its merchants
|
||||
const activeMarket = marketStore.activeMarket
|
||||
if (!activeMarket) {
|
||||
console.warn('No active market found')
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -191,12 +188,12 @@ export function useMarket() {
|
|||
|
||||
marketStore.addStall(stall)
|
||||
} catch (err) {
|
||||
console.warn('Failed to parse stall data:', err)
|
||||
// Silently handle parse errors
|
||||
}
|
||||
})
|
||||
|
||||
} catch (err) {
|
||||
console.error('Error loading stalls:', err)
|
||||
// Silently handle stall loading errors
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -205,7 +202,6 @@ export function useMarket() {
|
|||
try {
|
||||
const activeMarket = marketStore.activeMarket
|
||||
if (!activeMarket) {
|
||||
console.warn('No active market found')
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -260,12 +256,12 @@ export function useMarket() {
|
|||
|
||||
marketStore.addProduct(product)
|
||||
} catch (err) {
|
||||
console.warn('Failed to parse product data:', err)
|
||||
// Silently handle parse errors
|
||||
}
|
||||
})
|
||||
|
||||
} catch (err) {
|
||||
console.error('Error loading products:', err)
|
||||
// Silently handle product loading errors
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -314,7 +310,6 @@ export function useMarket() {
|
|||
try {
|
||||
const activeMarket = marketStore.activeMarket
|
||||
if (!activeMarket) {
|
||||
console.warn('No active market found for subscription')
|
||||
return null
|
||||
}
|
||||
|
||||
|
|
@ -334,7 +329,6 @@ export function useMarket() {
|
|||
|
||||
return unsubscribe
|
||||
} catch (error) {
|
||||
console.error('Failed to subscribe to market updates:', error)
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
|
@ -370,7 +364,6 @@ export function useMarket() {
|
|||
})
|
||||
|
||||
if (productsWithoutStalls.length > 0) {
|
||||
console.log('Found products without stalls:', productsWithoutStalls.length)
|
||||
// You could create default stalls or handle this as needed
|
||||
}
|
||||
}
|
||||
|
|
@ -393,7 +386,7 @@ export function useMarket() {
|
|||
marketStore.addStall(stall)
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('Failed to handle stall event:', err)
|
||||
// Silently handle stall event errors
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -422,7 +415,7 @@ export function useMarket() {
|
|||
marketStore.addProduct(product)
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('Failed to handle product data:', err)
|
||||
// Silently handle product event errors
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -445,23 +438,22 @@ export function useMarket() {
|
|||
updated_at: event.created_at
|
||||
}
|
||||
|
||||
// Note: addOrder method doesn't exist in the store, so we'll just log it
|
||||
console.log('Received order event:', order)
|
||||
// Note: addOrder method doesn't exist in the store, so we'll just handle it silently
|
||||
} catch (err) {
|
||||
console.warn('Failed to handle order event:', err)
|
||||
// Silently handle order event errors
|
||||
}
|
||||
}
|
||||
|
||||
// Publish a product
|
||||
const publishProduct = async (_productData: any) => {
|
||||
// Implementation would depend on your event creation logic
|
||||
console.log('Publishing product:', _productData)
|
||||
// TODO: Implement product publishing
|
||||
}
|
||||
|
||||
// Publish a stall
|
||||
const publishStall = async (_stallData: any) => {
|
||||
// Implementation would depend on your event creation logic
|
||||
console.log('Publishing stall:', _stallData)
|
||||
// TODO: Implement stall publishing
|
||||
}
|
||||
|
||||
// Connect to market
|
||||
|
|
@ -494,7 +486,6 @@ export function useMarket() {
|
|||
|
||||
} catch (err) {
|
||||
error.value = err instanceof Error ? err : new Error('Failed to connect to market')
|
||||
console.error('Error connecting to market:', err)
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue