Skip to content

Commit

Permalink
improved logging when protocol library fails to load
Browse files Browse the repository at this point in the history
  • Loading branch information
d99kris committed Oct 28, 2023
1 parent 47639f4 commit 548187f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/common/src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

#pragma once

#define NCHAT_VERSION "3.94"
#define NCHAT_VERSION "3.95"
18 changes: 14 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ class ProtocolFactory : public ProtocolBaseFactory
if (handle == nullptr)
{
LOG_ERROR("failed dlopen %s", libPath.c_str());
const char* dlerr = dlerror();
if (dlerr != nullptr)
{
LOG_ERROR("dlerror %s", dlerr);
}

std::cout << "Failed to load " << libPath << ", skipping profile.\n";
return protocol;
}

Expand Down Expand Up @@ -299,9 +306,12 @@ int main(int argc, char* argv[])
{
LOG_DEBUG("loading existing profile %s", profileId.c_str());
std::shared_ptr<Protocol> protocol = protocolFactory->Create();
protocol->LoadProfile(profilesDir, profileId);
ui->AddProtocol(protocol);
found = true;
if (protocol)
{
protocol->LoadProfile(profilesDir, profileId);
ui->AddProtocol(protocol);
found = true;
}
}
}

Expand Down Expand Up @@ -355,7 +365,7 @@ int main(int argc, char* argv[])
int rv = 0;
if (!hasProtocols)
{
std::cout << "no profiles setup, exiting.\n";
std::cout << "No profiles setup, exiting.\n";
rv = 1;
}

Expand Down
2 changes: 1 addition & 1 deletion src/nchat.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man.
.TH NCHAT "1" "October 2023" "nchat v3.94" "User Commands"
.TH NCHAT "1" "October 2023" "nchat v3.95" "User Commands"
.SH NAME
nchat \- ncurses chat
.SH SYNOPSIS
Expand Down

0 comments on commit 548187f

Please sign in to comment.