Live sample "Open in Codepen/JSFiddle" - should gracefully handle errors

RESOLVED FIXED

Status

developer.mozilla.org
General
RESOLVED FIXED
3 years ago
2 years ago

People

(Reporter: shobson, Unassigned)

Tracking

({in-triage})

Details

(Reporter)

Description

3 years ago
Rather than opening a blank pen or fiddle if the script can't find any code it should not place buttons on the page.

It should also log an error in google analytics so we can find and fix instances of these.

:sheppy can you confirm for me that there are samples that may just have HTML? Are there any that are just CSS or just JS?
(Reporter)

Updated

3 years ago
Flags: needinfo?(eshepherd)
Yes, there may be samples that are just HTML. JS-only samples are also possible although we're not doing them yet since there's no way for them to present output yet (we have a bug filed for that, in fact). There wouldn't be a CSS-only sample though.
Flags: needinfo?(eshepherd)
Blocks: 1148743
Keywords: in-triage
Example URL?  What would trigger this case?
(Reporter)

Comment 3

3 years ago
Bug 1194482 triggered this use case before it was fixed.

I assume there are other places where the script is failing, we just don't know about them yet. In those cases I would like to not display the faulty button to the users and log an error in Google Analytics - rather than relying on annoyed users to report bugs.
I'm not understanding what "failure" means.  Section address it was requesting was wrong?  Didn't parse any code content?  Got code content but didn't all transfer over to CodePen/JSFiddle?  No example URL or specific use case makes this difficult.
(Reporter)

Comment 5

3 years ago
It wasn't passing any code. CSS, HTML, and JS were all empty. 

In cases where CSS, HTMl, and JS fields would all be empty we shouldn't show the buttons and we should log an error in Google Analytics.

Comment 6

2 years ago
Commits pushed to master at https://github.com/mozilla/kuma

https://github.com/mozilla/kuma/commit/6fdd92df79b0d47d2d37214c45b1ee7f6cf8457d
Fix Bug 1195351 and Fix Bug 1198301 (Live Sample "open in" buttons)

Re-jigged when the sample sections are downloaded so they are parsed by the script to make sure there's code in them before we add the buttons to the page, log errors with GA if something goes wrong there.

https://github.com/mozilla/kuma/commit/8e6ea6c1b6183ec27b52ee0a3d35a15ca8a924a0
Merge pull request #3633 from stephaniehobson/1195351-empty-live-sample

Fix bugs 1195351 and 1198301: (Live Sample "open in" buttons)

Updated

2 years ago
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.