autobuild3 icon indicating copy to clipboard operation
autobuild3 copied to clipboard

libbase/ab{die,warn,err,info,...}: Use BASH_SOURCE & BASH_LINENO in err msgs

Open Artoria2e5 opened this issue 8 years ago • 0 comments

Expected output:

[WARN] foo/bar.sh:233: blah.

Extra points for abdie: backtrace.

Crappy things:

  • . will introduce an extra level of func call.
    • recsr gives you two, but that is acceptable.

Alternative solutions:

_abdie(){ ...:$errline: }
alias abdie='errline=$LINENO _abdie'

This will result in some by-func-or-by-script addressing. When you get source from FUNCNAME[0], you should look at BASH_SOURCE instead.

Artoria2e5 avatar May 07 '16 23:05 Artoria2e5