@antora/ui-loader
Advanced tools
Comparing version 3.1.6 to 3.1.7
@@ -11,2 +11,3 @@ 'use strict' | ||
const globStream = require('glob-stream') | ||
const { inspect } = require('util') | ||
const ospath = require('path') | ||
@@ -115,8 +116,6 @@ const { posix: path } = ospath | ||
).catch((err) => { | ||
const errWrapper = new Error( | ||
const msg = | ||
`Failed to read UI ${bundleFile.isDirectory() ? 'directory' : 'bundle'}: ` + | ||
(bundleUrl === bundleFile.path ? bundleUrl : `${bundleFile.path} (resolved from url: ${bundleUrl})`) | ||
) | ||
errWrapper.stack += `\nCaused by: ${err.stack || 'unknown'}` | ||
throw errWrapper | ||
(bundleUrl === bundleFile.path ? bundleUrl : `${bundleFile.path} (resolved from url: ${bundleUrl})`) | ||
throw transformError(err, msg) | ||
}) | ||
@@ -198,7 +197,7 @@ ), | ||
}).catch((err) => { | ||
const errWrapper = new Error(`${err.summary || 'Failed to download UI bundle'}: ${url}`) | ||
const errWrapper = transformError(err, `${err.summary || 'Failed to download UI bundle'}: ${url}`) | ||
if (err.code === 'ECONNRESET' || (err.message || '').toLowerCase() === 'request timed out') { | ||
errWrapper.recoverable = true | ||
Object.defineProperty(errWrapper, 'recoverable', { value: true }) | ||
} | ||
throw Object.assign(errWrapper, { stack: `${errWrapper.stack}\nCaused by: ${err.stack || 'unknown'}` }) | ||
throw errWrapper | ||
}) | ||
@@ -297,5 +296,3 @@ } | ||
} else { | ||
const errWrapper = new Error(`Failed to read ui.supplemental_files ${cwd ? `directory: ${dir}` : 'entry'}`) | ||
errWrapper.stack += `\nCaused by: ${err.stack || 'unknown'}` | ||
throw errWrapper | ||
throw transformError(err, `Failed to read ui.supplemental_files ${cwd ? `directory: ${dir}` : 'entry'}`) | ||
} | ||
@@ -414,2 +411,8 @@ }) | ||
function transformError (err, msg) { | ||
const errWrapper = new Error(msg) | ||
errWrapper.stack += `\nCaused by: ${err.stack ? inspect(err).replace(/^Error \[(.+)\](?=: )/, '$1') : err}` | ||
return errWrapper | ||
} | ||
module.exports = loadUi |
{ | ||
"name": "@antora/ui-loader", | ||
"version": "3.1.6", | ||
"version": "3.1.7", | ||
"description": "Downloads a UI bundle, if necessary, and loads the files into a UI catalog for use in an Antora documentation pipeline.", | ||
@@ -5,0 +5,0 @@ "license": "MPL-2.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21419
490