Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Better fix for getting base URL
  • Loading branch information
code-asher committed Aug 18, 2023
commit 37118f9c4e4bd575b0d3e594d68929556bf5b914
4 changes: 2 additions & 2 deletions src/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export class CertificateError extends Error {

// maybeWrap returns a CertificateError if the code is a certificate error
// otherwise it returns the original error.
static async maybeWrap<T>(err: T, address: string | undefined, logger: Logger): Promise<CertificateError | T> {
if (address && axios.isAxiosError(err)) {
static async maybeWrap<T>(err: T, address: string, logger: Logger): Promise<CertificateError | T> {
if (axios.isAxiosError(err)) {
switch (err.code) {
case X509_ERR_CODE.UNABLE_TO_VERIFY_LEAF_SIGNATURE:
// "Unable to verify" can mean different things so we will attempt to
Expand Down
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
axios.interceptors.response.use(
(r) => r,
async (err) => {
throw await CertificateError.maybeWrap(err, err?.config?.baseURL, storage)
throw await CertificateError.maybeWrap(err, axios.getUri(err.config), storage)
},
)

Expand Down