From cf7709576ab58b1612f9b3112c0e3a482e95ec6e Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Thu, 25 Nov 2021 23:43:10 +0100 Subject: [PATCH] fix(document from url): now listens to fix reaction to bad responses --- ts/smartswagger.classes.smartswagger.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ts/smartswagger.classes.smartswagger.ts b/ts/smartswagger.classes.smartswagger.ts index c45f4bc..98099c0 100644 --- a/ts/smartswagger.classes.smartswagger.ts +++ b/ts/smartswagger.classes.smartswagger.ts @@ -123,7 +123,12 @@ export class Smartswagger { headers: { 'accept-encoding': 'application/json', }, + }).catch(err => { + console.log(err); }); + if (!documentResponse || documentResponse.status > 299) { + return; + } const documentString = await documentResponse.text(); const apiDoc: IExtendedApiDoc = JSON.parse(documentString); console.log(`document successfully fetched!`);