Denzel Mendez commited on
Commit
dc98038
·
unverified ·
1 Parent(s): f542f73

Refactor logger error messages for consistency. (#1257)

Browse files
src/lib/assistantStats/refresh-assistants-counts.ts CHANGED
@@ -59,8 +59,7 @@ async function refreshAssistantsCountsHelper() {
59
  })
60
  );
61
  } catch (e) {
62
- logger.error("Refresh assistants counter failed!");
63
- logger.error(e);
64
  }
65
  }
66
 
 
59
  })
60
  );
61
  } catch (e) {
62
+ logger.error(e, "Refresh assistants counter failed!");
 
63
  }
64
  }
65
 
src/lib/server/endpoints/cloudflare/endpointCloudflare.ts CHANGED
@@ -113,7 +113,7 @@ export async function endpointCloudflare(
113
  data = JSON.parse(jsonString);
114
  } catch (e) {
115
  logger.error(e, "Failed to parse JSON");
116
- logger.error("Problematic JSON string:", jsonString);
117
  continue; // Skip this iteration and try the next chunk
118
  }
119
 
 
113
  data = JSON.parse(jsonString);
114
  } catch (e) {
115
  logger.error(e, "Failed to parse JSON");
116
+ logger.error(jsonString, "Problematic JSON string:");
117
  continue; // Skip this iteration and try the next chunk
118
  }
119
 
src/lib/server/endpoints/langserve/endpointLangserve.ts CHANGED
@@ -101,7 +101,7 @@ export function endpointLangserve(
101
  data = JSON.parse(jsonString);
102
  } catch (e) {
103
  logger.error(e, "Failed to parse JSON");
104
- logger.error("Problematic JSON string:", jsonString);
105
  continue; // Skip this iteration and try the next chunk
106
  }
107
  // Assuming content within data is a plain string
 
101
  data = JSON.parse(jsonString);
102
  } catch (e) {
103
  logger.error(e, "Failed to parse JSON");
104
+ logger.error(jsonString, "Problematic JSON string:");
105
  continue; // Skip this iteration and try the next chunk
106
  }
107
  // Assuming content within data is a plain string
src/lib/server/endpoints/llamacpp/endpointLlamacpp.ts CHANGED
@@ -95,7 +95,7 @@ export function endpointLlamacpp(
95
  data = JSON.parse(jsonString);
96
  } catch (e) {
97
  logger.error(e, "Failed to parse JSON");
98
- logger.error("Problematic JSON string:", jsonString);
99
  continue; // Skip this iteration and try the next chunk
100
  }
101
 
 
95
  data = JSON.parse(jsonString);
96
  } catch (e) {
97
  logger.error(e, "Failed to parse JSON");
98
+ logger.error(jsonString, "Problematic JSON string:");
99
  continue; // Skip this iteration and try the next chunk
100
  }
101
 
src/lib/server/models.ts CHANGED
@@ -88,10 +88,8 @@ async function getChatPromptRender(
88
  tokenizer = await getTokenizer(m.tokenizer);
89
  } catch (e) {
90
  logger.error(
91
- "Failed to load tokenizer for model " +
92
- m.name +
93
- " consider setting chatPromptTemplate manually or making sure the model is available on the hub. Error: " +
94
- (e as Error).message
95
  );
96
  process.exit();
97
  }
 
88
  tokenizer = await getTokenizer(m.tokenizer);
89
  } catch (e) {
90
  logger.error(
91
+ e,
92
+ `Failed to load tokenizer for model ${m.name} consider setting chatPromptTemplate manually or making sure the model is available on the hub.`
 
 
93
  );
94
  process.exit();
95
  }
src/lib/server/websearch/scrape/playwright.ts CHANGED
@@ -17,7 +17,7 @@ const blocker = await PlaywrightBlocker.fromPrebuiltAdsAndTracking(fetch)
17
  return mostBlocked;
18
  })
19
  .catch((err) => {
20
- logger.error("Failed to initialize PlaywrightBlocker from prebuilt lists", err);
21
  return PlaywrightBlocker.empty();
22
  });
23
 
 
17
  return mostBlocked;
18
  })
19
  .catch((err) => {
20
+ logger.error(err, "Failed to initialize PlaywrightBlocker from prebuilt lists");
21
  return PlaywrightBlocker.empty();
22
  });
23
 
src/lib/server/websearch/scrape/scrape.ts CHANGED
@@ -28,7 +28,7 @@ export const scrape = (maxCharsPerElem: number) =>
28
  return { ...source, page };
29
  } catch (e) {
30
  MetricsServer.getMetrics().webSearch.pageFetchCountError.inc();
31
- logger.debug(`Error scraping webpage: ${source.link}`, { error: e });
32
  }
33
  };
34
 
 
28
  return { ...source, page };
29
  } catch (e) {
30
  MetricsServer.getMetrics().webSearch.pageFetchCountError.inc();
31
+ logger.error(e, `Error scraping webpage: ${source.link}`);
32
  }
33
  };
34