-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose received broker connection close method, in case of any error,…
… to client during handshake
- Loading branch information
1 parent
373ac06
commit 5679a65
Showing
6 changed files
with
272 additions
and
147 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
** Copyright 2022 Bloomberg Finance L.P. | ||
** | ||
** Licensed under the Apache License, Version 2.0 (the "License"); | ||
** you may not use this file except in compliance with the License. | ||
** You may obtain a copy of the License at | ||
** | ||
** http://www.apache.org/licenses/LICENSE-2.0 | ||
** | ||
** Unless required by applicable law or agreed to in writing, software | ||
** distributed under the License is distributed on an "AS IS" BASIS, | ||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
** See the License for the specific language governing permissions and | ||
** limitations under the License. | ||
*/ | ||
|
||
#include <amqpprox_closeerror.h> | ||
#include <amqpprox_methods_close.h> | ||
#include <stdexcept> | ||
|
||
namespace Bloomberg { | ||
namespace amqpprox { | ||
|
||
CloseError::CloseError(const std::string &msg, methods::Close &closeMethod) | ||
: std::runtime_error(msg) | ||
, d_closeMethod(closeMethod) | ||
{ | ||
} | ||
|
||
methods::Close CloseError::closeMethod() const | ||
{ | ||
return d_closeMethod; | ||
} | ||
|
||
} | ||
} |
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,52 @@ | ||
/* | ||
** Copyright 2022 Bloomberg Finance L.P. | ||
** | ||
** Licensed under the Apache License, Version 2.0 (the "License"); | ||
** you may not use this file except in compliance with the License. | ||
** You may obtain a copy of the License at | ||
** | ||
** http://www.apache.org/licenses/LICENSE-2.0 | ||
** | ||
** Unless required by applicable law or agreed to in writing, software | ||
** distributed under the License is distributed on an "AS IS" BASIS, | ||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
** See the License for the specific language governing permissions and | ||
** limitations under the License. | ||
*/ | ||
|
||
#ifndef BLOOMBERG_AMQPPROX_CLOSEERROR | ||
#define BLOOMBERG_AMQPPROX_CLOSEERROR | ||
|
||
#include <amqpprox_methods_close.h> | ||
#include <stdexcept> | ||
|
||
namespace Bloomberg { | ||
namespace amqpprox { | ||
|
||
/** | ||
* \brief Custom exception class | ||
* | ||
* This class will be used to throw custom exception, whenever we get the | ||
* unexpected connection Close method from server during handshake. Using this | ||
* exception, we are going to pass connection Close method to the exception | ||
* handler. The exception handler eventually can send the Close method to | ||
* clients for better error handling. | ||
*/ | ||
class CloseError : public std::runtime_error { | ||
methods::Close d_closeMethod; | ||
|
||
public: | ||
// CREATORS | ||
CloseError(const std::string &msg, methods::Close &closeMethod); | ||
|
||
// ACCESSORS | ||
/** | ||
* \return connection Close method | ||
*/ | ||
methods::Close closeMethod() const; | ||
}; | ||
|
||
} | ||
} | ||
|
||
#endif |
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.