Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix validation error of protocol not beeing returned #843

Merged
merged 4 commits into from
Sep 1, 2023

Conversation

glasgio
Copy link
Contributor

@glasgio glasgio commented Aug 30, 2023

Fixes #830

Fix the "https: or mailto:" error being overwritten by the error in the catch by passing it upwards trough the cause property

Fixes web-push-libs#830

Fix the "https: or mailto:" error being overwritten by the error in the catch by passing upwards trough the cause property
src/vapid-helper.js Outdated Show resolved Hide resolved
@marco-c
Copy link
Member

marco-c commented Sep 1, 2023

Thanks!

@marco-c
Copy link
Member

marco-c commented Sep 1, 2023

Oops, there is still some error:

/home/runner/work/web-push/web-push/src/vapid-helper.js
Error: 79:11 error 'subjectParseResult' is assigned a value but never used no-unused-vars
Error: 83:39 error 'subjectParseResult' is not defined no-undef
Error: 86:7 error 'subjectParseResult' is not defined no-undef

@glasgio
Copy link
Contributor Author

glasgio commented Sep 1, 2023

Oops, there is still some error:

/home/runner/work/web-push/web-push/src/vapid-helper.js
Error: 79:11 error 'subjectParseResult' is assigned a value but never used no-unused-vars
Error: 83:39 error 'subjectParseResult' is not defined no-undef
Error: 86:7 error 'subjectParseResult' is not defined no-undef

It makes sense since the subjectParseResult is now scoped, sorry. Do you prefer an approach like defining the variable before the try?

let subjectParseResult = subject
try {
subjectParseResult = new URL(subject);

@marco-c
Copy link
Member

marco-c commented Sep 1, 2023

Yeah, let's do:

let subjectParseResult = null;
try {
    subjectParseResult = new URL(subject);

@marco-c marco-c merged commit 15dc7b3 into web-push-libs:master Sep 1, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Validation error of protocol is never returned
2 participants