Skip to content

Commit

Permalink
Fix bug in validate-external-links.py script (#3516)
Browse files Browse the repository at this point in the history
## Description

This fixes a bug in the script `validate-external-links.py`:

```
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/runner/_work/infra-config/infra-config/website/scripts/validate-external-links.py", line 162, in <module>
    external_links += [check_link(link, internal_url) for link
  File "/home/runner/_work/infra-config/infra-config/website/scripts/validate-external-links.py", line 162, in <listcomp>
    external_links += [check_link(link, internal_url) for link
  File "/home/runner/_work/infra-config/infra-config/website/scripts/validate-external-links.py", line 121, in check_link
    return ExternalLink(True, page, url, -1, f'Request exception: {str(e)}')
NameError: name 'e' is not defined
```


https://github.com/WATonomous/infra-config/actions/runs/12543562204/job/34975031171?pr=3501

<img width="2032" alt="image"
src="https://github.com/user-attachments/assets/a2bd60dc-da71-4f59-8d59-4e234430536c"
/>


## Checklist
- [x] I have read and understood the [WATcloud
Guidelines](https://cloud.watonomous.ca/docs/community-docs/watcloud/guidelines)
- [x] I have performed a self-review of my code
  • Loading branch information
rickyhuangjh authored Dec 30, 2024
1 parent 6ab581e commit f5c73a7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/validate-external-links.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def check_link(url: str, page: str) -> ExternalLink:

except requests.exceptions.Timeout:
return ExternalLink(True, page, url, -1, "Timeout")
except requests.exceptions.RequestException:
except requests.exceptions.RequestException as e:
# Any error like connection issues are treated as broken links
return ExternalLink(True, page, url, -1, f'Request exception: {str(e)}')

Expand Down

0 comments on commit f5c73a7

Please sign in to comment.