aboutsummaryrefslogtreecommitdiff
path: root/examples/extending-augeas/aug-fileErrorMsg-usage.js
blob: 9e5b8000bd8ab5faf617def754abe6d2eff6bd58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
var libaugeas = require('./aug-fileErrorMsg.js');


// should give an error if running unprivileged:
var testfile = '/etc/sudoers';


// Creating Augeas asynchronously:
libaugeas.createAugeas(function(aug) {
    console.log(aug.fileErrorMsg(testfile));
    console.log(aug.dumpFileErrors());
});

/* Example output:
/etc/sudoers: Permission denied
[ '/etc/mke2fs.conf:3:0: Get did not match entire input',
  '/etc/host.conf:15:0: Iterated lens matched less than it should',
  '/etc/securetty: Permission denied',
  '/etc/sysctl.conf: Permission denied',
  '/etc/sudoers: Permission denied' ]
*/