colorize outer exception printing

This commit is contained in:
Michael Davidsaver
2026-01-05 13:00:22 -08:00
parent 597330c949
commit 444d1ff1f1
12 changed files with 25 additions and 19 deletions
+1 -3
View File
@@ -23,6 +23,7 @@
#include <pvxs/iochooks.h>
#include "qsrvpvt.h"
#include "utilpvt.h"
#include "groupsource.h"
#include "groupconfigprocessor.h"
#include "iocshcommand.h"
@@ -30,9 +31,6 @@
#if EPICS_VERSION_INT < VERSION_INT(7, 0, 3, 1)
# define iocshSetError(ret) do { (void)ret; }while(0)
#endif
#ifndef ERL_ERROR
# define ERL_ERROR "ERROR"
#endif
// include last to avoid clash of #define printf with other headers
#include <epicsStdio.h>
+2
View File
@@ -5,6 +5,8 @@ include $(TOP)/configure/CONFIG
# ADD MACRO DEFINITIONS AFTER THIS LINE
#=============================
USR_CPPFLAGS += -I$(TOP)/src
PROD_IOC += softIocPVX
softIocPVX_SRCS += softMain.cpp
+2 -1
View File
@@ -32,6 +32,7 @@
#include "iocsh.h"
#include "osiFileName.h"
#include "epicsInstallDir.h"
#include "utilpvt.h"
#include <pvxs/iochooks.h>
@@ -289,7 +290,7 @@ int main(int argc, char *argv[])
return 0;
}catch(std::exception& e){
std::cerr<<"Error: "<<e.what()<<"\n";
std::cerr<<ERL_ERROR ": "<<e.what()<<"\n";
epicsExit(2);
return 2;
}
+5
View File
@@ -30,6 +30,7 @@
#include <compilerDependencies.h>
#include <epicsThread.h>
#include <errlog.h>
#include <pvxs/version.h>
#include <pvxs/util.h>
@@ -46,6 +47,10 @@
# endif
#endif
#ifndef ERL_ERROR
# define ERL_ERROR "ERROR"
#endif
#include <epicsThread.h>
namespace pvxs {namespace impl {
+4 -4
View File
@@ -86,14 +86,14 @@ int main(int argc, char *argv[])
auto sep = fv.find_first_of('=');
if(sep==std::string::npos) {
std::cerr<<"Error: expected <fld>=<value> not \""<<escape(fv)<<"\"\n";
std::cerr<<ERL_ERROR ": expected <fld>=<value> not \""<<escape(fv)<<"\"\n";
return 1;
}
auto key(fv.substr(0, sep));
if(values.find(key)!=values.end()) {
std::cerr<<"Error: duplicate argument name "<<key<<"\n";
std::cerr<<ERL_ERROR ": duplicate argument name "<<key<<"\n";
return 1;
}
@@ -133,7 +133,7 @@ int main(int argc, char *argv[])
std::cout<<val;
ret=0;
}catch(std::exception& e){
std::cerr<<"Error "<<typeid(e).name()<<" : "<<e.what()<<"\n";
std::cerr<<ERL_ERROR " "<<typeid(e).name()<<" : "<<e.what()<<"\n";
ret=1;
}
done.signal();
@@ -154,7 +154,7 @@ int main(int argc, char *argv[])
return ret;
}
}catch(std::exception& e){
std::cerr<<"Error: "<<e.what()<<"\n";
std::cerr<<ERL_ERROR ": "<<e.what()<<"\n";
return 1;
}
}
+1 -1
View File
@@ -145,7 +145,7 @@ int main(int argc, char *argv[])
return 2;
}
}catch(std::exception& e){
std::cerr<<"Error: "<<e.what()<<"\n";
std::cerr<<ERL_ERROR ": "<<e.what()<<"\n";
return 1;
}
}
+1 -1
View File
@@ -120,7 +120,7 @@ int main(int argc, char *argv[])
return 2;
}
}catch(std::exception& e){
std::cerr<<"Error: "<<e.what()<<"\n";
std::cerr<<ERL_ERROR ": "<<e.what()<<"\n";
return 1;
}
}
+1 -1
View File
@@ -205,7 +205,7 @@ int main(int argc, char *argv[])
return 0;
}catch(std::exception& e){
std::cerr<<"Error: "<<e.what()<<"\n";
std::cerr<<ERL_ERROR ": "<<e.what()<<"\n";
return 1;
}
}
+1 -1
View File
@@ -179,7 +179,7 @@ int main(int argc, char *argv[])
return 2;
}
}catch(std::exception& e){
std::cerr<<"Error: "<<e.what()<<"\n";
std::cerr<<ERL_ERROR ": "<<e.what()<<"\n";
return 1;
}
}
+3 -3
View File
@@ -60,7 +60,7 @@ SockEndpoint parseEP(const char* optarg, const server::Config& conf)
ep = SockEndpoint(optarg, conf.udp_port);
}catch(std::exception& e){
std::cerr<<"Error: Invalid group spec. '"<<escape(optarg)<<"' : "<<e.what()<<std::endl;
std::cerr<<ERL_ERROR ": Invalid group spec. '"<<escape(optarg)<<"' : "<<e.what()<<std::endl;
exit(1);
}
if(ep.addr.family()!=AF_INET) {
@@ -278,7 +278,7 @@ int main(int argc, char *argv[])
if(argc!=optind) {
usage(argv[0]);
std::cerr<<"Error: Unexpected arguments."<<std::endl;
std::cerr<<ERL_ERROR ": Unexpected arguments."<<std::endl;
return 1;
}
@@ -294,7 +294,7 @@ int main(int argc, char *argv[])
return 0;
}catch(std::exception& e){
std::cerr<<"Error: "<<e.what()<<"\n";
std::cerr<<ERL_ERROR ": "<<e.what()<<"\n";
return 1;
}
}
+3 -3
View File
@@ -95,7 +95,7 @@ int main(int argc, char *argv[])
auto sep = fv.find_first_of('=');
if(sep==std::string::npos) {
std::cerr<<"Error: expected <fld>=<value> not \""<<escape(fv)<<"\"\n";
std::cerr<<ERL_ERROR ": expected <fld>=<value> not \""<<escape(fv)<<"\"\n";
return 1;
}
@@ -136,7 +136,7 @@ int main(int argc, char *argv[])
try {
result();
}catch(std::exception& e){
std::cerr<<"Error "<<typeid(e).name()<<" : "<<e.what()<<"\n";
std::cerr<<ERL_ERROR " "<<typeid(e).name()<<" : "<<e.what()<<"\n";
ret=1;
}
done.signal();
@@ -157,7 +157,7 @@ int main(int argc, char *argv[])
return ret;
}
}catch(std::exception& e){
std::cerr<<"Error: "<<e.what()<<"\n";
std::cerr<<ERL_ERROR ": "<<e.what()<<"\n";
return 1;
}
}
+1 -1
View File
@@ -253,7 +253,7 @@ int main(int argc, char *argv[])
return 0;
}catch(std::runtime_error& e) {
errlogFlush();
std::cerr<<"Error: "<<e.what()<<std::endl;
std::cerr<<ERL_ERROR ": "<<e.what()<<std::endl;
return 1;
}
}