Home
Software
Writings
Tech note: JavaScript debugging helpers
in: Diary of a solo dev building a web app
💡
This is a dev diary of implementing Filerion, a web-based file manager for online storage (Dropbox, OneDrive, Google Drive, s3 and more).A tech note is a deeper description of some technical problem I’ve encountered and solved.
Let’s say you want to test handling of failing API backend call. Unfortunately it’s not easy to trigger.
How to make it easier to trigger? We can modify the code to introduce a buggy invocation. That works but what if we want to do it in the feature, without modifying the code all the time?
What I do is: I add window.debug object that exposes a bunch of functions that help in debugging the app.
It could be listing information internal to the app.
It could be setting a flag to change app’s behavior.
It could be forcing the next API call to fail to exercise handling of failures.
Those functions can be called in dev tools console.
Written on Jul 14 2022.
home
Found a mistake, have a comment? Let me know.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you: