openapi-explorer 2.2.705 → 2.2.706

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,14 +7,22 @@ export default async function ProcessSpec(specUrlOrObject, serverUrl = '') {
7
7
  var _jsonParsedSpec$info, _jsonParsedSpec$compo;
8
8
  const inputSpecIsAUrl = typeof specUrlOrObject === 'string' && specUrlOrObject.match(/^http/) || typeof specUrlOrObject === 'object' && typeof specUrlOrObject.href === 'string';
9
9
  let jsonParsedSpec;
10
- try {
11
- jsonParsedSpec = await OpenApiResolver(specUrlOrObject);
12
- } catch (error) {
13
- // eslint-disable-next-line no-console
14
- console.error('Error parsing specification', error);
15
- throw Error(`Failed to resolve the spec: ${error.message}`);
10
+ let errorToDisplay;
11
+ for (let iteration = 0; iteration < 7; iteration++) {
12
+ try {
13
+ jsonParsedSpec = await OpenApiResolver(specUrlOrObject);
14
+ break;
15
+ } catch (error) {
16
+ // eslint-disable-next-line no-console
17
+ console.error('Error parsing specification', error);
18
+ errorToDisplay = error.message;
19
+ await new Promise(resolve => setTimeout(resolve, 100 * 2 ** iteration));
20
+ }
16
21
  }
17
22
  if (!jsonParsedSpec) {
23
+ if (errorToDisplay) {
24
+ throw Error(`Failed to resolve the spec: ${errorToDisplay}`);
25
+ }
18
26
  throw Error('SpecificationNotFound');
19
27
  }
20
28
 
@@ -13,14 +13,22 @@ async function ProcessSpec(specUrlOrObject, serverUrl = '') {
13
13
  var _jsonParsedSpec$info, _jsonParsedSpec$compo;
14
14
  const inputSpecIsAUrl = typeof specUrlOrObject === 'string' && specUrlOrObject.match(/^http/) || typeof specUrlOrObject === 'object' && typeof specUrlOrObject.href === 'string';
15
15
  let jsonParsedSpec;
16
- try {
17
- jsonParsedSpec = await (0, _openapiResolverBrowser.default)(specUrlOrObject);
18
- } catch (error) {
19
- // eslint-disable-next-line no-console
20
- console.error('Error parsing specification', error);
21
- throw Error(`Failed to resolve the spec: ${error.message}`);
16
+ let errorToDisplay;
17
+ for (let iteration = 0; iteration < 7; iteration++) {
18
+ try {
19
+ jsonParsedSpec = await (0, _openapiResolverBrowser.default)(specUrlOrObject);
20
+ break;
21
+ } catch (error) {
22
+ // eslint-disable-next-line no-console
23
+ console.error('Error parsing specification', error);
24
+ errorToDisplay = error.message;
25
+ await new Promise(resolve => setTimeout(resolve, 100 * 2 ** iteration));
26
+ }
22
27
  }
23
28
  if (!jsonParsedSpec) {
29
+ if (errorToDisplay) {
30
+ throw Error(`Failed to resolve the spec: ${errorToDisplay}`);
31
+ }
24
32
  throw Error('SpecificationNotFound');
25
33
  }
26
34
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openapi-explorer",
3
- "version": "2.2.705",
3
+ "version": "2.2.706",
4
4
  "description": "OpenAPI Explorer - API viewer with dynamically generated components, documentation, and interaction console",
5
5
  "author": "Authress Developers <developers@authress.io>",
6
6
  "type": "module",