Skip to content

Commit 9b78ba3

Browse files
committed
improvements in URL error reporting
1 parent d9d9022 commit 9b78ba3

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

plugin.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,16 @@ const APPLICATION_JSON = 'application/json'
1818
class RequestWrapper {
1919
constructor(request) {
2020
this.request = request
21-
this.url = new URL(request.getUrl())
21+
22+
const url = request.getUrl()
23+
24+
if (!url) throw new Error('No URL specified')
25+
26+
try {
27+
this.url = new URL(url)
28+
} catch (error) {
29+
throw new Error(`Invalid URL specified: ${url}`)
30+
}
2231

2332
for (const parameter of request.getParameters()) {
2433
this.url.searchParams.append(parameter.name, parameter.value)

0 commit comments

Comments
 (0)