From abb04c5a2528d4c6fa0f939dd5f99840012ef393 Mon Sep 17 00:00:00 2001 From: xzeldon Date: Fri, 21 Oct 2022 10:23:23 +0300 Subject: [PATCH] debug log --- src/balabola_api.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/balabola_api.ts b/src/balabola_api.ts index 7637f48..1bbba15 100644 --- a/src/balabola_api.ts +++ b/src/balabola_api.ts @@ -17,6 +17,8 @@ export class BalabolaError extends Error { } const BASE_URL = 'https://yandex.ru/lab/api/yalm/text3'; export async function balabola(query: string, intro: number): Promise { + logger.debug({ query, intro }); + const result = await fetch(BASE_URL, { method: 'POST', body: JSON.stringify({ @@ -26,8 +28,6 @@ export async function balabola(query: string, intro: number): Promise { }) }).then(res => res.json()) as BalabolaResponse; - logger.debug(result); - if (result.bad_query === 1) throw new BalabolaError('bad query'); return result.text;