INNER CODE UNIT · JavaScript

parseJsonSafely

WJZ-P/gemini-skill · src/atlas-provider.js:15

async function parseJsonSafely(response) {
  const raw = await response.text();
  try {
    return { raw, data: JSON.parse(raw) };
  } catch {
    return { raw, data: null };
  }
}

async function atlasRequest(path, { apiKey, method = 'GET', body, timeoutMs } = {}) {
  const finalApiKey = resolveApiKey(apiKey);
  const controller = new AbortController();
  const timer = setTimeout(() => controller.abort(), timeoutMs ?? config.atlasRequestTimeoutMs);

  try {
    const response = await fetch(joinUrl(config.atlasBaseUrl, path), {
      method,
      headers: {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…