Commit 9214f0eb authored by Seblu's avatar Seblu
Browse files

Print error code in log file on error

parent 68cecfc7
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -77,9 +77,20 @@ int main(int argc, char *argv[])
    return ERR_NO;
  }
  catch (const Error &e) {
    if (S.started()) S.stop();
    if (D.opened()) D.close();
    // Close server if started
    if (S.started())
      S.stop();

    // Save data in database
    if (D.opened())
      D.close();

    // print error
    e.print();

    // Print exit code if in daemon and verbose mode
    if (O.daemon && O.verbose) std::cerr << "Exit with code: " << e.code() << std::endl;

    return e.code();
  }
}