-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
302 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
packages/cpp/ArmoniK.Api.Common/header/exceptions/ArmoniKApiException.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#ifndef ARMONIK_API_ARMONIKAPIEXCEPTION_H | ||
#define ARMONIK_API_ARMONIKAPIEXCEPTION_H | ||
|
||
#include <stdexcept> | ||
namespace API_COMMON_NAMESPACE::exceptions { | ||
|
||
class ArmoniKApiException : public std::runtime_error { | ||
public: | ||
explicit ArmoniKApiException(const std::string &message) : runtime_error(message) {} | ||
}; | ||
} // namespace API_COMMON_NAMESPACE::exceptions | ||
|
||
#endif // ARMONIK_API_ARMONIKAPIEXCEPTION_H |
36 changes: 36 additions & 0 deletions
36
packages/cpp/ArmoniK.Api.Common/header/exceptions/ArmoniKTaskError.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#ifndef ARMONIK_API_ARMONIKTASKERROR_H | ||
#define ARMONIK_API_ARMONIKTASKERROR_H | ||
|
||
#include "ArmoniKApiException.h" | ||
#include <objects.pb.h> | ||
#include <sstream> | ||
#include <vector> | ||
namespace API_COMMON_NAMESPACE::exceptions { | ||
|
||
class ArmoniKTaskError : public ArmoniKApiException { | ||
public: | ||
explicit ArmoniKTaskError(const std::string &message, const armonik::api::grpc::v1::TaskError &task_error) | ||
: ArmoniKApiException(message) { | ||
std::stringstream ss; | ||
ss << "TaskId : " << task_error.task_id() << " Errors : "; | ||
for (auto &&e : task_error.errors()) { | ||
std::string status = armonik::api::grpc::v1::task_status::TaskStatus_Name(e.task_status()); | ||
status_details.emplace_back(status, e.detail()); | ||
ss << '\n' << status << " : " << e.detail(); | ||
} | ||
details = std::string(ArmoniKApiException::what()) + " : " + ss.str(); | ||
taskId_ = task_error.task_id(); | ||
} | ||
[[nodiscard]] const char *what() const noexcept override { return details.c_str(); } | ||
const std::string &taskId() { return taskId_; } | ||
const std::vector<std::pair<std::string, std::string>> &error_details() { return status_details; } | ||
|
||
private: | ||
std::string details; | ||
std::string taskId_; | ||
std::vector<std::pair<std::string, std::string>> status_details; | ||
}; | ||
|
||
} // namespace API_COMMON_NAMESPACE::exceptions | ||
|
||
#endif // ARMONIK_API_ARMONIKTASKERROR_H |
15 changes: 15 additions & 0 deletions
15
packages/cpp/ArmoniK.Api.Common/header/exceptions/ArmoniKTaskNotCompletedException.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#ifndef ARMONIK_API_ARMONIKTASKNOTCOMPLETEDEXCEPTION_H | ||
#define ARMONIK_API_ARMONIKTASKNOTCOMPLETEDEXCEPTION_H | ||
|
||
#include "ArmoniKApiException.h" | ||
namespace API_COMMON_NAMESPACE::exceptions { | ||
|
||
class ArmoniKTaskNotCompletedException : public ArmoniKApiException { | ||
public: | ||
explicit ArmoniKTaskNotCompletedException(const std::string &taskId, const std::string &message = "") | ||
: ArmoniKApiException("Task " + taskId + " not completed. " + message), taskId(taskId) {} | ||
const std::string taskId; | ||
}; | ||
} // namespace API_COMMON_NAMESPACE::exceptions | ||
|
||
#endif // ARMONIK_API_ARMONIKTASKNOTCOMPLETEDEXCEPTION_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.