mirror of
https://github.com/mfontanini/libtins
synced 2026-01-23 02:35:57 +01:00
Use custom exceptions everywhere
This commit is contained in:
@@ -30,9 +30,9 @@
|
||||
#ifndef TINS_ADDRESS_RANGE
|
||||
#define TINS_ADDRESS_RANGE
|
||||
|
||||
#include <stdexcept>
|
||||
#include <iterator>
|
||||
#include "endianness.h"
|
||||
#include "exceptions.h"
|
||||
#include "detail/address_helpers.h"
|
||||
|
||||
namespace Tins {
|
||||
@@ -198,7 +198,7 @@ public:
|
||||
AddressRange(const address_type& first, const address_type& last, bool only_hosts = false)
|
||||
: first_(first), last_(last), only_hosts_(only_hosts){
|
||||
if (last_ < first_) {
|
||||
throw std::runtime_error("Invalid address range");
|
||||
throw exception_base("Invalid address range");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -100,6 +100,14 @@ public:
|
||||
invalid_address() : exception_base("Invalid address") { }
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Exception thrown when a PDU option is set using an incorrect value
|
||||
*/
|
||||
class invalid_option_value : public exception_base {
|
||||
public:
|
||||
invalid_option_value() : exception_base("Invalid option value") { }
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Exception thrown when a field is not present in frame.
|
||||
*/
|
||||
@@ -204,6 +212,10 @@ public:
|
||||
pcap_error(const char* message) : exception_base(message) {
|
||||
|
||||
}
|
||||
|
||||
pcap_error(const std::string& message) : exception_base(message) {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user