Hi,

suppose I have a lens:

    module Minimal =
      autoload xfm

    let del_str = Util.del_str
    let eol = Util.eol

    let entry = [label "entry" . store /[0-9]+/] . eol

    let begin = del_str "BEGIN" . eol
    let contents = entry*
    let end = del_str "END" . eol

    let lns = begin . contents . end

    let xfm = transform lns (incl "/tmp/minimal")

and file /tmp/minimal:

    BEGIN
    12
    32
    aa
    45
    END

This produces a not very informative error message:

    augtool> print /augeas/files/tmp/minimal/error
    /augeas/files/tmp/minimal/error = "parse_failed"
    /augeas/files/tmp/minimal/error/pos = "0"
    /augeas/files/tmp/minimal/error/line = "1"
    /augeas/files/tmp/minimal/error/char = "0"
/augeas/files/tmp/minimal/error/lens = "/usr/share/augeas/lenses/dist/minimal.aug:13.10-.32:" /augeas/files/tmp/minimal/error/message = "Input string does not match at all"


------------------------------------------------------------------------
Now if I omit the begin and end from both the lens the file so I end up with a lens:

    ...
    let lns = contents
    ...

and file:

    12
    32
    aa
    45

I get much better and more informative error message:

    augtool> print /augeas/files/tmp/minimal/error
    /augeas/files/tmp/minimal/error = "parse_failed"
    /augeas/files/tmp/minimal/error/pos = "5"
    /augeas/files/tmp/minimal/error/line = "2"
    /augeas/files/tmp/minimal/error/char = "2"
/augeas/files/tmp/minimal/error/lens = "/usr/share/augeas/lenses/dist/minimal.aug:10.15-.21:" /augeas/files/tmp/minimal/error/lens/last_matched = "/usr/share/augeas/lenses/dist/minimal.aug:7.12-.26:" /augeas/files/tmp/minimal/error/message = "Iterated lens matched less than it should"

Is there a way to get the information of the second error message without manually omiting the encapsulation of the iterated lens?

Thanks,
Štěpán

_______________________________________________
augeas-devel mailing list
augeas-devel@redhat.com
https://www.redhat.com/mailman/listinfo/augeas-devel

Reply via email to