-
Notifications
You must be signed in to change notification settings - Fork 0
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
Added chrome.debugger to monitor network requests #44
Changes from 8 commits
3df16da
eb579ae
e9f6c69
a1da0aa
7de7b2d
315e91f
75dc4e1
2d42293
69b6924
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { IBytesRepository } from "../data/bytes/IBytesRepository"; | ||
|
||
export const addBytesTransferred = async (bytes: number) => { | ||
IBytesRepository.instance.addBytesTransferred(bytes); | ||
|
||
try { | ||
await chrome.runtime.sendMessage({ | ||
command: { | ||
bytesTransferredChanged: | ||
IBytesRepository.instance.getBytesTransferred(), | ||
}, | ||
}); | ||
} catch (e: unknown) { | ||
if (e instanceof Error) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SImilar error question here |
||
if ( | ||
e.message === | ||
"Could not establish connection. Receiving end does not exist." | ||
) { | ||
console.warn( | ||
`Error Caught: ${e}\nIf popup is open and this error is seen in the console, debugging is required.` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Debugging is required as soon as you have an error, isn't it? We should maybe consider it the other way around "if popup is closed then the error is ok" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can catch this error by checking
|
||
); | ||
} | ||
} else { | ||
throw e; | ||
} | ||
} | ||
}; |
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When is
e
not an Error?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is always going to be an error -
It's typed as unknown because I don't think typing in catch clauses are allowed yet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case, I'd probably remove the if condition and just type cast it as an Error