8000 @uppy/companion-client: fix log type error by mifi · Pull Request #4766 · transloadit/uppy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

@uppy/companion-client: fix log type error #4766

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

Merged
merged 2 commits into from
Nov 21, 2023
Merged
Changes from all commits
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
12 changes: 11 additions & 1 deletion packages/@uppy/companion-client/src/Provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,17 @@ export default class Provider extends RequestClient {
const authWindow = window.open(link, '_blank')
const handleToken = (e) => {
if (e.source !== authWindow) {
this.uppy.log.warn('ignoring event from unknown source', e)
let jsonData = ''
try {
// TODO improve our uppy logger so that it can take an arbitrary number of arguments,
// each either objects, errors or strings,
// then we don’t have to manually do these things like json stringify when logging.
// the logger should never throw an error.
jsonData = JSON.stringify(e.data)
} catch (err) {
// in case JSON.stringify fails (ignored)
}
this.uppy.log(`ignoring event from unknown source ${jsonData}`, 'warning')
return
}

Expand Down
0