if (that.results[0].rows.length<1) { {error: new Error("no data got for readtyphead")} } else { that.query.instance.typname = that.results[0].rows[0][2]; that.query.instance.typtext = that.results[0].rows[0][3]; that.query.instance.typdesc = that.results[0].rows[0][4]; }