-
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
Handle API warnings #8
Comments
For the record, I already have some local code for this, but I haven’t pushed it yet. I can probably do it soon, though. |
Hm, I’m not yet sure how this should interact with combining requests. When two requests with the same And does the answer to that change when we add additional context to errors and warnings, such as the parameters for the request? What does that look like for combined errors/warnings, anyways? |
I think for now I’ll have |
Introduces a new ApiWarnings class, like ApiErrors. (No common superclass, there’s not enough common code for it to be worth sharing in my opinion.) This one’s not thrown, but having a stack trace can still be useful. The default warning handler is console.warn in the browser (should be fine, users don’t usually look there), while in Node.js it’s only console.warn if NODE_ENV is explicitly set to “development”, otherwise Node.js sends warnings into the void by default. README.md and CHANGES.md encourage users to configure console.warn as the handler unconditionally, but I don’t want to risk breaking CLI applications by sending warnings to the console by default. combine.js already needs to implement custom support for this option (JSON.stringify() silently discards functions, so the previous code would’ve ignored different warn functions), so I figured we might as well implement the proper thing in this commit, where we can actually combine requests with different warn options, just calling each request’s warning handler with the same warnings object. Include some tests for that as well. Implements #8.
Done in 1298970. We can still tweak it before the 1.0.0 release. |
Currently, we handle API errors, but not warnings. We should do better (putting my money where my mouth is: https://phabricator.wikimedia.org/T295215#7489064).
The text was updated successfully, but these errors were encountered: