[erlang-questions] add a time interval to a timestamp

Mazen Harake <>
Tue Mar 15 21:24:55 CET 2011

If you use my foo/1 function wrong, say you use a string instead of an
int I'd say "your problem" rather than being "nice" and returning
{error, not_int}.

In this case you are using an API, you should know how to call it. If
you don't call it correctly it will (at least should, in some cases)
crash but _why_ doesn't matter to you as long as it doesn't crash when
you call it correctly, you'll never jump into an unknown *.erl file
just because you called it incorrectly.

I think this is a very healthy way to look at systems, makes my code
much cleaner than handling {error, you_called_this_function_wrong}.

PS: The exception is when {error, something} is part of the behaviour
of the function E.g. {error, unable_to_connect}.

My 2 cents. :)

On 15 March 2011 18:53,  <> wrote:
> On Tue, 15 Mar 2011 15:50:34 +0100
> Mazen Harake <> wrote:
>> I would say that this is a _good_ thing. More functions in standard
>> applications should crash when not used properly.
> Shouldn't the error be related to the function at hand and not it's
> internals? That exception isn't very useful unless you go digging
> around in calendar.erl
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:

More information about the erlang-questions mailing list