Skip to content

Commit

Permalink
HPCC-30390 Improve get dafilesrv service errors
Browse files Browse the repository at this point in the history
Signed-off-by: Jake Smith <[email protected]>
  • Loading branch information
jakesmith committed Sep 28, 2023
1 parent b4450b3 commit 0a7ee5b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions system/jlib/jerror.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#define JLIBERR_InternalError 6002
#define JLIBERR_CppCompileError 6003
#define JLIBERR_UnexpectedValue 6004
#define JLIBERR_K8sServiceError 6005

//---- Text for all errors (make it easy to internationalise) ---------------------------

Expand Down
8 changes: 4 additions & 4 deletions system/jlib/jmisc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1084,17 +1084,17 @@ std::pair<std::string, unsigned> getDafileServiceFromConfig(const char *applicat
VStringBuffer serviceXPath("services[@type='%s']", application);
Owned<IPropertyTreeIterator> dafilesrvServices = getGlobalConfigSP()->getElements(serviceXPath);
if (!dafilesrvServices->first())
throw makeStringException(-1, "dafilesrv service not defined");
throw makeStringExceptionV(JLIBERR_K8sServiceError, "dafilesrv service '%s' not defined or disabled", application);
const IPropertyTree &dafilesrv = dafilesrvServices->query();
if (!dafilesrv.getPropBool("@public"))
throw makeStringException(-1, "dafilesrv service has no public service defined");
throw makeStringExceptionV(JLIBERR_K8sServiceError, "dafilesrv service '%s' has no public service defined", application);
StringBuffer dafilesrvName;
dafilesrv.getProp("@name", dafilesrvName);
auto externalService = getExternalService(dafilesrvName);
if (externalService.first.empty())
throw makeStringExceptionV(-1, "dafilesrv '%s': external service not found", dafilesrvName.str());
throw makeStringExceptionV(JLIBERR_K8sServiceError, "dafilesrv service '%s' - external service '%s' not found", application, dafilesrvName.str());
if (0 == externalService.second)
throw makeStringExceptionV(-1, "dafilesrv '%s': external service port not defined", dafilesrvName.str());
throw makeStringExceptionV(JLIBERR_K8sServiceError, "dafilesrv service '%s' - external service '%s' port not defined", application, dafilesrvName.str());
return externalService;
}

Expand Down

0 comments on commit 0a7ee5b

Please sign in to comment.