0
Error Handling
I realize I haven’t read much about this yet for Javascript. Anyone have a good place to start? Or is there a lesson on error handling for Javascript in SL? Thanks!
2 odpowiedzi
+ 2
There really isn't a decent error handling lesson anywhere. They do a great job for this or that error and ignore the bigger picture. How to prevent errors from happening.
My philosophy is to ignore program bug error handling as the default handler gives me enough to fix them. I concentrate on user controlled errors.
It is a guarantee that some user will find a way to break your code, unless you verify every user action is legal. If the only time hitting a button can be processed is when a checkbox is checked, disable the button until you are guaranteed it is valid. Why waste time making checks for conditions, if you can prevent them.
Check user data for validity. Enable features only when it makes sense for the user to use them. By limiting what the user's options are, you limit the code you must test. You also simplify your testing.
+ 1
Thanks @John. It’s good to know at least that there’s not a large amount of things in JS for this. My experience coming from Python was different. There are many ways to deal with errors and also what to do when errors/exceptions come up.
If I take a step back and think, errors happen when I put is not compatible with a program. Something doesn’t fit right. So your answer is what I expect to do. Thanks!