Forward the error message

Signed-off-by: Dominik Henneke <dominik.henneke@sda-se.com>
This commit is contained in:
Dominik Henneke
2021-09-08 09:58:57 +02:00
parent 9554de545b
commit 93917b72c1
2 changed files with 3 additions and 3 deletions
@@ -345,7 +345,7 @@ describe('PlaceholderProcessor', () => {
},
),
).rejects.toThrow(
'Placeholder $text could not form a URL out of ./a/b/catalog-info.yaml and ../c/catalog-info.yaml',
'Placeholder $text could not form a URL out of ./a/b/catalog-info.yaml and ../c/catalog-info.yaml, TypeError: Invalid base URL: ./a/b/catalog-info.yaml',
);
expect(read).not.toBeCalled();
@@ -216,13 +216,13 @@ function relativeUrl({
try {
return resolveUrl(value, baseUrl);
} catch (_) {
} catch (e) {
// The only remaining case that isn't support is a relative file path that should be
// resolved using a relative file location. Accessing local file paths can lead to
// path traversal attacks and access to any file on the host system. Implementing this
// would require additional security measures.
throw new Error(
`Placeholder \$${key} could not form a URL out of ${baseUrl} and ${value}`,
`Placeholder \$${key} could not form a URL out of ${baseUrl} and ${value}, ${e}`,
);
}
}