diff options
| author | Igor Pashev <pashev.igor@gmail.com> | 2012-04-28 19:46:32 +0400 |
|---|---|---|
| committer | Igor Pashev <pashev.igor@gmail.com> | 2012-04-28 19:46:32 +0400 |
| commit | f871c18d31e8f2f5c4e1692a27732f9d2d4a6bed (patch) | |
| tree | 3f6afba9d00a0f0361998dde52d4555141d1f4b0 | |
| parent | d40220c1df37d5b981250880dc3043c38bca53d0 (diff) | |
| download | node-augeas-f871c18d31e8f2f5c4e1692a27732f9d2d4a6bed.tar.gz | |
Code cleanup
| -rw-r--r-- | libaugeas.cc | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/libaugeas.cc b/libaugeas.cc index 17080c5..d0986fa 100644 --- a/libaugeas.cc +++ b/libaugeas.cc @@ -697,19 +697,16 @@ Handle<Value> LibAugeas::load(const Arguments& args) LibAugeas *obj = ObjectWrap::Unwrap<LibAugeas>(args.This()); + /* aug_load() returns -1 on error, 0 on success. Success includes the case + * where some files could not be loaded. Details of such files can be found + * as '/augeas//error'. + */ int rc = aug_load(obj->m_aug); - if (0 == rc) { - // ok - return scope.Close(Undefined()); - } else { - /* TODO: error description is under /augeas/.../error - * Example: - * /augeas/files/etc/hosts/error = "open_augnew" - * /augeas/files/etc/hosts/error/message = "No such file or directory" - */ + if (0 != rc) { ThrowException(Exception::Error(String::New("Failed to load files"))); - return scope.Close(Undefined()); } + + return scope.Close(Undefined()); } |
