Js, if(err) return next(err); Is this normal?

  node.js, question

To write anode.jsAfter writing the most is

if(err) return next(err);

Is this normal?


Update: I usedexpress.jsDowebDevelopment.

Let me give you a reference. HASKELL was seen at the front end and implemented a Maybe with js. Haskell has a way of dealing with errors. For reference only.

// Date Maybe x = Nothing | Just x
 function Maybe(value){
 this._valid = true;
 this.value = value;
 bracket
 Maybe.prototype = {
 constructor:Maybe,
 // _bind:: Maybe a -> (a -> Maybe b) -> Maybe b
 // bind = _bind this
 bind:function (fn) {
 if(!  this._valid) { return Nothing;  bracket
 return fn.call(null,this.value);
 },
 // _then:: Maybe a -> Maybe b -> Maybe b
 // then = _then this
 then:function(fn) {
 return fn.call(null);
 },
 toString:function(){
 if (!  this._valid) { return "Nothing";  bracket
 Return "Just "plus this.value.toString ();
 bracket
 };
 
 var Nothing = new Maybe(undefined);
 Nothing._valid = false;
 function Just(value)
 bracket
 return new Maybe(value);
 bracket
 Maybe.Nothing = Nothing;
 Maybe.Just = Just;

Examples:

// subOne:: int -> Maybe int
 function subOne(value){
 //Suppose negative numbers are not allowed.
 if(value === 0) return Nothing;
 value--;
 return Just(value);
 bracket
 var ret=Just(5).bind(subOne).bind(subOne).bind(subOne).bind(subOne).bind(subOne).bind(subOne);