Faspstream Manager C/C++ API  3.6.1
A C and C++ language interface to basic streaming over the fasp protocol
FaspStreamException.h
Go to the documentation of this file.
1 /*
2  * Aspera, Inc.
3  *
4  * C++ only.
5  *
6  * FaspStreamException class.
7  */
8 #pragma once
9 
10 #include <string>
11 #include <vector>
12 #include <Poco/String.h>
13 
14 class DebugInfo
15 {
16 private:
17  std::string _executable;
18  std::string _arguments;
19 
20 public:
21  DebugInfo(const std::string executable,
22  const std::vector<std::string> arguments) :
23  _executable(executable) {
24 
25  _arguments = Poco::cat(std::string(" "), arguments.begin(),
26  arguments.end());
27 
28  }
29 
30  DebugInfo(const DebugInfo &di) :
31  _executable(di._executable),
32  _arguments(di._arguments) { }
33 
35  _executable("faspstream"),
36  _arguments("") {}
37 
38  std::string getCommonIssueMessage() const {
39  std::string message("Please check to ensure that:\n");
40  message.append(" You have a valid aspera.conf file\n");
41  message.append(" You have a valid Aspera Client license\n");
42  message.append(" You have installed ");
43  message.append(_executable);
44  message.append(" properly\n");
45  message.append(" Your firewall is not blocking your TCP or UDP ports\n");
46  message.append(" Command-line arguments: \n");
47  message.append(_arguments);
48 
49  return message;
50  }
51 
52 };
53 
58 class FaspStreamException : public std::exception {
59 public:
60  FaspStreamException(const std::string& what, const DebugInfo &info) :
61  _what(what), _details(info) {}
62  FaspStreamException(const std::string& what) : _what(what) {}
64  _what(ex._what), _details(ex._details) {}
65  virtual ~FaspStreamException() throw() {}
66  /*
67  * Info
68  */
69  virtual const char* what() const throw() { return _what.c_str(); }
70  virtual std::string getDebugDetails() const {
71  return _details.getCommonIssueMessage();
72  }
73 private:
74  std::string _what;
75  DebugInfo _details;
76 };
std::string getCommonIssueMessage() const
Definition: FaspStreamException.h:38
virtual ~FaspStreamException()
Definition: FaspStreamException.h:65
Definition: FaspStreamException.h:58
DebugInfo()
Definition: FaspStreamException.h:34
FaspStreamException(const std::string &what, const DebugInfo &info)
Definition: FaspStreamException.h:60
FaspStreamException(const std::string &what)
Definition: FaspStreamException.h:62
virtual std::string getDebugDetails() const
Definition: FaspStreamException.h:70
Definition: FaspStreamException.h:14
DebugInfo(const DebugInfo &di)
Definition: FaspStreamException.h:30
FaspStreamException(const FaspStreamException &ex)
Definition: FaspStreamException.h:63
DebugInfo(const std::string executable, const std::vector< std::string > arguments)
Definition: FaspStreamException.h:21
virtual const char * what() const
Definition: FaspStreamException.h:69