Skip to main content
CSS-Tricks
  • Articles
  • Notes
  • Links
  • Guides
  • Almanac
  • Picks
  • Shuffle
Search

Articles Tagged
error handling

3 Articles
{
,

}
Direct link to the article Required Parameters for Functions in JavaScript
error handling JavaScript parameters

Required Parameters for Functions in JavaScript

Ooo this is clever! I’m snagging this from David’s blog.

const isRequired = () => { throw new Error('param is required'); };

const hello = (name = isRequired()) => { console.log(`hello ${name}`) };

// These will throw errors
hello();
…
Chris Coyier on Jan 2, 2020
Direct link to the article ​​Avoiding those dang cannot read property of undefined errors
error handling JavaScript

​​Avoiding those dang cannot read property of undefined errors

​​​​Uncaught TypeError: Cannot read property 'foo' of undefined.​ The dreaded error we all hit at some point in JavaScript development. Could be an empty state from an API that returns differently than you expected. Could be something else. …

Adam Giese on Feb 13, 2019
Direct link to the article Better Broken Image Handling
error handling images

Better Broken Image Handling

Missing images will either just display nothing, or display a [ ? ] style box when their source cannot be found. Instead, you may want to replace that with a “missing image” graphic that you are sure exists so there …

Chris Coyier on Nov 8, 2010 Updated on Nov 10, 2018

CSS-Tricks is powered by DigitalOcean.

Keep up to date on web dev

with our hand-crafted newsletter

DigitalOcean
  • About DO
  • Cloudways
  • Legal stuff
  • Get free credit!
CSS-Tricks
  • Contact
  • Write for CSS-Tricks!
  • Advertise with us
Social
  • RSS Feeds
  • CodePen
  • Mastodon
  • Bluesky
Back to Top