FAQ
I am currently writing a node js library. Now I came up with the question
what would be the best approach to indicate a usage error by the programmer.

For example if I got the following function in my public API:

function doSomething(aNumber) {
// ...
}

and I need to make sure that aNumber actually is a number, what way of
error handling should I go if the API user passes a parameter that is not.

By convetion functions in node should return an Error object if an error
occurs. But in my case this is no error the programmer should catch.

So my question is what would be the most appropriate way to maybe simply
"end" the program with an error message, telling the programmer that he did
not use my API in the correct way.

--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 2 | next ›
Discussion Overview
groupnodejs @
categoriesnodejs
postedJul 2, '12 at 2:24p
activeJul 2, '12 at 2:34p
posts2
users2
websitenodejs.org
irc#node.js

People

Translate

site design / logo © 2022 Grokbase