0

When developing your own jQuery plugins, is there a standard or a preferred way to throw errors? Should I just use jQuery.error()? Should I first set it, e.g. jQuery.error = console.error or leave it set to the default?

EDIT: To be clear, errors meant for the developer, not the user. I assume the developer should be handling all errors and my plugin should just return certain values if things fail.

2
  • Do not assume console exists! Older versions of IE will ruin you. if (typeof console !== 'undefined') { ... } . Also see this answer Commented Dec 9, 2014 at 2:04
  • Good thing I don't support older versions of IE! ;) But point noted. Commented Dec 9, 2014 at 2:06

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.