From fcb81541887a7be8492bc339b87ad27814378895 Mon Sep 17 00:00:00 2001 From: rakshasa Date: Mon, 11 Dec 2006 10:33:09 +0000 Subject: [PATCH] * Cleaned up the exception classes so they require less space. This reduced the size of the stripped libtorrent by 1/7. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@822 e378c898-3ddf-0310-93e7-cc216c733640 --- src/command_scheduler.cc | 6 +++--- src/command_scheduler_item.cc | 4 ++-- src/core/download_factory.cc | 6 +++--- src/core/download_list.cc | 14 +++++++------- src/core/manager.cc | 6 +++--- src/core/scheduler.cc | 4 ++-- src/core/view.cc | 16 ++++++++-------- src/core/view_manager.cc | 2 +- src/display/frame.cc | 12 ++++++------ src/display/text_element_list.cc | 4 ++-- src/display/utils.cc | 10 +++++----- src/input/manager.cc | 2 +- src/ui/download.cc | 10 +++++----- src/ui/download_list.cc | 10 +++++----- src/ui/element_chunks_seen.cc | 12 ++++++------ src/ui/element_download_list.cc | 6 +++--- src/ui/element_file_list.cc | 16 ++++++++-------- src/ui/element_log_complete.cc | 4 ++-- src/ui/element_menu.cc | 4 ++-- src/ui/element_peer_list.cc | 6 +++--- src/ui/element_string_list.cc | 4 ++-- src/ui/element_text.cc | 4 ++-- src/ui/element_tracker_list.cc | 14 +++++++------- src/ui/element_transfer_list.cc | 12 ++++++------ src/ui/root.cc | 4 ++-- src/utils/variable_map.cc | 2 +- 26 files changed, 97 insertions(+), 97 deletions(-) diff --git a/src/command_scheduler.cc b/src/command_scheduler.cc index 0c6e7f4b..1f0daba0 100644 --- a/src/command_scheduler.cc +++ b/src/command_scheduler.cc @@ -85,10 +85,10 @@ CommandScheduler::erase(iterator itr) { void CommandScheduler::call_item(value_type item) { if (item->is_queued()) - throw torrent::client_error("CommandScheduler::call_item(...) called but item is still queued."); + throw torrent::internal_error("CommandScheduler::call_item(...) called but item is still queued."); if (std::find(begin(), end(), item) == end()) - throw torrent::client_error("CommandScheduler::call_item(...) called but the item isn't in the scheduler."); + throw torrent::internal_error("CommandScheduler::call_item(...) called but the item isn't in the scheduler."); // Remove the item before calling the command if it should be // removed. @@ -110,7 +110,7 @@ CommandScheduler::call_item(value_type item) { } if (next <= cachedTime) - throw torrent::client_error("CommandScheduler::call_item(...) tried to schedule a zero interval item."); + throw torrent::internal_error("CommandScheduler::call_item(...) tried to schedule a zero interval item."); item->enable(next); } diff --git a/src/command_scheduler_item.cc b/src/command_scheduler_item.cc index 30e85f49..6e46a5db 100644 --- a/src/command_scheduler_item.cc +++ b/src/command_scheduler_item.cc @@ -47,7 +47,7 @@ CommandSchedulerItem::~CommandSchedulerItem() { void CommandSchedulerItem::enable(rak::timer t) { if (t == rak::timer()) - throw torrent::client_error("CommandSchedulerItem::enable() t == rak::timer()."); + throw torrent::internal_error("CommandSchedulerItem::enable() t == rak::timer()."); if (is_queued()) disable(); @@ -71,7 +71,7 @@ CommandSchedulerItem::next_time_scheduled() const { return rak::timer(); if (m_timeScheduled == rak::timer()) - throw torrent::client_error("CommandSchedulerItem::next_time_scheduled() m_timeScheduled == rak::timer()."); + throw torrent::internal_error("CommandSchedulerItem::next_time_scheduled() m_timeScheduled == rak::timer()."); rak::timer next = m_timeScheduled; diff --git a/src/core/download_factory.cc b/src/core/download_factory.cc index 6c9b2a13..8c55e33f 100644 --- a/src/core/download_factory.cc +++ b/src/core/download_factory.cc @@ -101,7 +101,7 @@ DownloadFactory::commit() { void DownloadFactory::receive_load() { if (m_stream) - throw torrent::client_error("DownloadFactory::load() called on an object with m_stream != NULL"); + throw torrent::internal_error("DownloadFactory::load() called on an object with m_stream != NULL"); if (std::strncmp(m_uri.c_str(), "http://", 7) == 0) { // Http handling here. @@ -143,7 +143,7 @@ DownloadFactory::receive_commit() { void DownloadFactory::receive_success() { if (m_stream == NULL) - throw torrent::client_error("DownloadFactory::receive_success() called on an object with m_stream == NULL."); + throw torrent::internal_error("DownloadFactory::receive_success() called on an object with m_stream == NULL."); Download* download = m_manager->download_list()->create(m_stream, m_printLog); @@ -252,7 +252,7 @@ DownloadFactory::receive_success() { void DownloadFactory::receive_failed(const std::string& msg) { if (m_stream == NULL) - throw torrent::client_error("DownloadFactory::receive_success() called on an object with m_stream == NULL"); + throw torrent::internal_error("DownloadFactory::receive_success() called on an object with m_stream == NULL"); // Add message to log. if (m_printLog) { diff --git a/src/core/download_list.cc b/src/core/download_list.cc index 69de898e..7199f158 100644 --- a/src/core/download_list.cc +++ b/src/core/download_list.cc @@ -60,7 +60,7 @@ inline void DownloadList::check_contains(Download* d) { #ifdef USE_EXTRA_DEBUG if (std::find(begin(), end(), d) == end()) - throw torrent::client_error("DownloadList::check_contains(...) failed."); + throw torrent::internal_error("DownloadList::check_contains(...) failed."); #endif } @@ -128,7 +128,7 @@ DownloadList::insert(Download* download) { } catch (torrent::local_error& e) { // Should perhaps relax this, just print an error and remove the // downloads? - throw torrent::client_error("Caught during DownloadList::insert(...): " + std::string(e.what())); + throw torrent::internal_error("Caught during DownloadList::insert(...): " + std::string(e.what())); } return itr; @@ -144,7 +144,7 @@ DownloadList::erase(Download* download) { DownloadList::iterator DownloadList::erase(iterator itr) { if (itr == end()) - throw torrent::client_error("DownloadList::erase(...) could not find download."); + throw torrent::internal_error("DownloadList::erase(...) could not find download."); // Makes sure close doesn't restart hashing of this download. (*itr)->set_hash_failed(true); @@ -223,7 +223,7 @@ DownloadList::close_throw(Download* download) { download->download()->close(); if (!download->is_hash_failed() && download->variable()->get_value("hashing") != Download::variable_hashing_stopped) - throw torrent::client_error("DownloadList::close_throw(...) called but we're going into a hashing loop."); + throw torrent::internal_error("DownloadList::close_throw(...) called but we're going into a hashing loop."); std::for_each(slot_map_hash_removed().begin(), slot_map_hash_removed().end(), download_list_call(download)); std::for_each(slot_map_close().begin(), slot_map_close().end(), download_list_call(download)); @@ -391,10 +391,10 @@ DownloadList::hash_done(Download* download) { check_contains(download); if (!download->is_open()) - throw torrent::client_error("DownloadList::hash_done(...) !download->is_open()."); + throw torrent::internal_error("DownloadList::hash_done(...) !download->is_open()."); if (download->is_hash_checking() || download->is_active()) - throw torrent::client_error("DownloadList::hash_done(...) download in invalid state."); + throw torrent::internal_error("DownloadList::hash_done(...) download in invalid state."); if (!download->is_hash_checked()) { download->set_hash_failed(true); @@ -463,7 +463,7 @@ DownloadList::hash_queue(Download* download, int type) { check_contains(download); if (download->variable()->get_value("hashing") != Download::variable_hashing_stopped) - throw torrent::client_error("DownloadList::hash_queue(...) hashing already queued."); + throw torrent::internal_error("DownloadList::hash_queue(...) hashing already queued."); close_throw(download); torrent::resume_clear_progress(*download->download(), download->download()->bencode()->get_key("libtorrent_resume")); diff --git a/src/core/manager.cc b/src/core/manager.cc index 4f975955..9cffdb26 100644 --- a/src/core/manager.cc +++ b/src/core/manager.cc @@ -204,7 +204,7 @@ Manager::~Manager() { void Manager::set_hashing_view(View* v) { if (v == NULL || m_hashingView != NULL) - throw torrent::client_error("Manager::set_hashing_view(...) received NULL or is already set."); + throw torrent::internal_error("Manager::set_hashing_view(...) received NULL or is already set."); m_hashingView = v; v->signal_changed().connect(sigc::mem_fun(this, &Manager::receive_hashing_changed)); @@ -501,7 +501,7 @@ Manager::receive_hashing_changed() { } if ((*itr)->is_hash_checked()) - throw torrent::client_error("core::Manager::receive_hashing_changed() hash already checked or checking."); + throw torrent::internal_error("core::Manager::receive_hashing_changed() hash already checked or checking."); if ((*itr)->is_hash_failed() || (*itr)->variable()->get_value("hashing") != Download::variable_hashing_initial) continue; @@ -533,7 +533,7 @@ Manager::receive_hashing_changed() { try { if ((*itr)->is_hash_checked() || (*itr)->is_hash_checking()) - throw torrent::client_error("core::Manager::receive_hashing_changed() hash already checked or checking."); + throw torrent::internal_error("core::Manager::receive_hashing_changed() hash already checked or checking."); if ((*itr)->is_hash_failed()) continue; diff --git a/src/core/scheduler.cc b/src/core/scheduler.cc index a7791f66..5b078938 100644 --- a/src/core/scheduler.cc +++ b/src/core/scheduler.cc @@ -82,7 +82,7 @@ Scheduler::update() { for (View::iterator itr = m_view->begin_visible(), last = m_view->end_visible(); curActive > target; ++itr) { if (itr == last) - throw torrent::client_error("Scheduler::update() loop bork."); + throw torrent::internal_error("Scheduler::update() loop bork."); if ((*itr)->is_active()) { m_downloadList->pause(*itr); @@ -94,7 +94,7 @@ Scheduler::update() { for (View::iterator itr = m_view->begin_visible(), last = m_view->end_visible(); curActive < m_maxActive; ++itr) { if (itr == last) - throw torrent::client_error("Scheduler::update() loop bork."); + throw torrent::internal_error("Scheduler::update() loop bork."); if (!(*itr)->is_active()) { m_downloadList->start_try(*itr); diff --git a/src/core/view.cc b/src/core/view.cc index ebf23b7a..70661667 100644 --- a/src/core/view.cc +++ b/src/core/view.cc @@ -59,15 +59,15 @@ View::~View() { void View::initialize(const std::string& name, core::DownloadList* dlist) { if (!m_name.empty()) - throw torrent::client_error("View::initialize(...) called on an already initialized view."); + throw torrent::internal_error("View::initialize(...) called on an already initialized view."); if (name.empty()) - throw torrent::client_error("View::initialize(...) called with an empty name."); + throw torrent::internal_error("View::initialize(...) called with an empty name."); std::string key = "0_view_" + name; if (dlist->has_slot_insert(key) || dlist->has_slot_erase(key)) - throw torrent::client_error("View::initialize(...) duplicate key name found in DownloadList."); + throw torrent::internal_error("View::initialize(...) duplicate key name found in DownloadList."); m_name = name; m_list = dlist; @@ -166,7 +166,7 @@ View::filter() { void View::set_filter_on(int event) { if (event == DownloadList::SLOTS_INSERT || event == DownloadList::SLOTS_ERASE || event >= DownloadList::SLOTS_MAX_SIZE) - throw torrent::client_error("View::filter_on(...) invalid event."); + throw torrent::internal_error("View::filter_on(...) invalid event."); m_list->slots(event)["0_view_" + m_name] = sigc::bind(sigc::mem_fun(this, &View::received), event); } @@ -191,7 +191,7 @@ View::insert_visible(Download* d) { inline void View::erase(iterator itr) { if (itr == end_filtered()) - throw torrent::client_error("View::erase_visible(...) iterator out of range."); + throw torrent::internal_error("View::erase_visible(...) iterator out of range."); m_size -= (itr < end_visible()); m_focus -= (m_focus > position(itr)); @@ -207,7 +207,7 @@ View::received(core::Download* download, int event) { case DownloadList::SLOTS_INSERT: if (itr != base_type::end()) - throw torrent::client_error("View::received(..., SLOTS_INSERT) already inserted."); + throw torrent::internal_error("View::received(..., SLOTS_INSERT) already inserted."); if (view_downloads_filter(m_filter)(download)) insert_visible(download); @@ -215,7 +215,7 @@ View::received(core::Download* download, int event) { base_type::insert(end_filtered(), download); if (m_focus > m_size) - throw torrent::client_error("View::received(...) m_focus > m_size."); + throw torrent::internal_error("View::received(...) m_focus > m_size."); break; @@ -225,7 +225,7 @@ View::received(core::Download* download, int event) { default: if (itr == end_filtered()) - throw torrent::client_error("View::received(..., SLOTS_*) could not find download."); + throw torrent::internal_error("View::received(..., SLOTS_*) could not find download."); if (view_downloads_filter(m_filter)(download)) { diff --git a/src/core/view_manager.cc b/src/core/view_manager.cc index 506ba612..08dc4157 100644 --- a/src/core/view_manager.cc +++ b/src/core/view_manager.cc @@ -162,7 +162,7 @@ ViewManager::clear() { ViewManager::iterator ViewManager::insert(const std::string& name) { if (find(name) != end()) - throw torrent::client_error("ViewManager::insert(...) name already inserted."); + throw torrent::internal_error("ViewManager::insert(...) name already inserted."); View* view = new View(); view->initialize(name, m_list); diff --git a/src/display/frame.cc b/src/display/frame.cc index bea4674d..e995dc77 100644 --- a/src/display/frame.cc +++ b/src/display/frame.cc @@ -172,7 +172,7 @@ Frame::preferred_size() const { void Frame::set_container_size(size_type size) { if ((m_type != TYPE_ROW && m_type != TYPE_COLUMN) || size >= max_size) - throw torrent::client_error("Frame::set_container_size(...) Bad state."); + throw torrent::internal_error("Frame::set_container_size(...) Bad state."); while (m_containerSize > size) { delete m_container[--m_containerSize]; @@ -187,7 +187,7 @@ Frame::set_container_size(size_type size) { void Frame::initialize_window(Window* window) { if (m_type != TYPE_NONE) - throw torrent::client_error("Frame::initialize_window(...) m_type != TYPE_NONE."); + throw torrent::internal_error("Frame::initialize_window(...) m_type != TYPE_NONE."); m_type = TYPE_WINDOW; m_window = window; @@ -196,10 +196,10 @@ Frame::initialize_window(Window* window) { void Frame::initialize_row(size_type size) { if (m_type != TYPE_NONE) - throw torrent::client_error("Frame::initialize_container(...) Invalid state."); + throw torrent::internal_error("Frame::initialize_container(...) Invalid state."); if (size > max_size) - throw torrent::client_error("Frame::initialize_container(...) size >= max_size."); + throw torrent::internal_error("Frame::initialize_container(...) size >= max_size."); m_type = TYPE_ROW; m_containerSize = size; @@ -211,10 +211,10 @@ Frame::initialize_row(size_type size) { void Frame::initialize_column(size_type size) { if (m_type != TYPE_NONE) - throw torrent::client_error("Frame::initialize_container(...) Invalid state."); + throw torrent::internal_error("Frame::initialize_container(...) Invalid state."); if (size > max_size) - throw torrent::client_error("Frame::initialize_container(...) size >= max_size."); + throw torrent::internal_error("Frame::initialize_container(...) size >= max_size."); m_type = TYPE_COLUMN; m_containerSize = size; diff --git a/src/display/text_element_list.cc b/src/display/text_element_list.cc index cf3eca5a..3cded292 100644 --- a/src/display/text_element_list.cc +++ b/src/display/text_element_list.cc @@ -61,12 +61,12 @@ TextElementList::print(char* first, char* last, Canvas::attributes_list* attribu char* columnEnd = std::min(last, first + *m_columnWidth); if (columnEnd < first || columnEnd > last) - throw torrent::client_error("TextElementList::print(...) columnEnd < first || columnEnd > last."); + throw torrent::internal_error("TextElementList::print(...) columnEnd < first || columnEnd > last."); first = (*itr)->print(first, columnEnd, attributes, object); if (first > columnEnd) - throw torrent::client_error("TextElementList::print(...) first > columnEnd."); + throw torrent::internal_error("TextElementList::print(...) first > columnEnd."); std::memset(first, ' ', columnEnd - first); first = columnEnd; diff --git a/src/display/utils.cc b/src/display/utils.cc index cfd83858..634f4759 100644 --- a/src/display/utils.cc +++ b/src/display/utils.cc @@ -81,7 +81,7 @@ print_hhmmss_local(char* first, char* last, time_t t) { if (u == NULL) //return "inv_time"; - throw torrent::client_error("print_hhmmss_local(...) failed."); + throw torrent::internal_error("print_hhmmss_local(...) failed."); return print_buffer(first, last, "%2u:%02u:%02u", u->tm_hour, u->tm_min, u->tm_sec); } @@ -100,7 +100,7 @@ print_ddmmyyyy(char* first, char* last, time_t t) { if (u == NULL) //return "inv_time"; - throw torrent::client_error("print_ddmmyyyy(...) failed."); + throw torrent::internal_error("print_ddmmyyyy(...) failed."); return print_buffer(first, last, "%02u/%02u/%04u", u->tm_mday, (u->tm_mon + 1), (1900 + u->tm_year)); } @@ -165,7 +165,7 @@ print_download_info(char* first, char* last, core::Download* d) { first = print_buffer(first, last, "]"); if (first > last) - throw torrent::client_error("print_download_info(...) wrote past end of the buffer."); + throw torrent::internal_error("print_download_info(...) wrote past end of the buffer."); return first; } @@ -197,7 +197,7 @@ print_download_status(char* first, char* last, core::Download* d) { } if (first > last) - throw torrent::client_error("print_download_status(...) wrote past end of the buffer."); + throw torrent::internal_error("print_download_status(...) wrote past end of the buffer."); return first; } @@ -266,7 +266,7 @@ print_status_info(char* first, char* last) { } if (first > last) - throw torrent::client_error("print_status_info(...) wrote past end of the buffer."); + throw torrent::internal_error("print_status_info(...) wrote past end of the buffer."); if (!rak::socket_address::cast_from(torrent::connection_manager()->bind_address())->is_address_any()) { first = print_buffer(first, last, " [Bind "); diff --git a/src/input/manager.cc b/src/input/manager.cc index ab6cd3dc..042d5788 100644 --- a/src/input/manager.cc +++ b/src/input/manager.cc @@ -56,7 +56,7 @@ Manager::erase(Bindings* b) { Base::erase(itr); if (std::find(begin(), end(), b) != end()) - throw torrent::client_error("Manager::erase(...) found duplicate bindings."); + throw torrent::internal_error("Manager::erase(...) found duplicate bindings."); } void diff --git a/src/ui/download.cc b/src/ui/download.cc index 79f59743..687bf41b 100644 --- a/src/ui/download.cc +++ b/src/ui/download.cc @@ -96,7 +96,7 @@ Download::Download(core::Download* d) : Download::~Download() { if (is_active()) - throw torrent::client_error("ui::Download::~Download() called on an active object."); + throw torrent::internal_error("ui::Download::~Download() called on an active object."); std::for_each(m_uiArray, m_uiArray + DISPLAY_MAX_SIZE, rak::call_delete()); @@ -187,7 +187,7 @@ Download::create_info() { void Download::activate(display::Frame* frame, bool focus) { if (is_active()) - throw torrent::client_error("ui::Download::activate() called on an already activated object."); + throw torrent::internal_error("ui::Download::activate() called on an already activated object."); control->input()->push_back(&m_bindings); @@ -203,7 +203,7 @@ Download::activate(display::Frame* frame, bool focus) { void Download::disable() { if (!is_active()) - throw torrent::client_error("ui::Download::disable() called on an already disabled object."); + throw torrent::internal_error("ui::Download::disable() called on an already disabled object."); control->input()->erase(&m_bindings); @@ -218,10 +218,10 @@ Download::disable() { void Download::activate_display(Display displayType, bool focusDisplay) { if (!is_active()) - throw torrent::client_error("ui::Download::activate_display(...) !is_active()."); + throw torrent::internal_error("ui::Download::activate_display(...) !is_active()."); if (displayType > DISPLAY_MAX_SIZE) - throw torrent::client_error("ui::Download::activate_display(...) out of bounds"); + throw torrent::internal_error("ui::Download::activate_display(...) out of bounds"); if (focusDisplay == m_focusDisplay && displayType == m_state) return; diff --git a/src/ui/download_list.cc b/src/ui/download_list.cc index fa7f695a..8e7b3e49 100644 --- a/src/ui/download_list.cc +++ b/src/ui/download_list.cc @@ -91,7 +91,7 @@ DownloadList::~DownloadList() { void DownloadList::activate(display::Frame* frame, bool focus) { if (is_active()) - throw torrent::client_error("ui::DownloadList::activate() called on an already activated object"); + throw torrent::internal_error("ui::DownloadList::activate() called on an already activated object"); m_frame = frame; @@ -122,10 +122,10 @@ DownloadList::current_view() { void DownloadList::activate_display(Display displayType) { if (!is_active()) - throw torrent::client_error("ui::DownloadList::activate_display(...) !is_active()."); + throw torrent::internal_error("ui::DownloadList::activate_display(...) !is_active()."); if (displayType > DISPLAY_MAX_SIZE) - throw torrent::client_error("ui::DownloadList::activate_display(...) out of bounds"); + throw torrent::internal_error("ui::DownloadList::activate_display(...) out of bounds"); if (displayType == m_state) return; @@ -240,7 +240,7 @@ DownloadList::receive_view_input(Input type) { break; default: - throw torrent::client_error("DownloadList::receive_view_input(...) Invalid input type."); + throw torrent::internal_error("DownloadList::receive_view_input(...) Invalid input type."); } ElementStringList* esl = dynamic_cast(m_uiArray[DISPLAY_STRING_LIST]); @@ -292,7 +292,7 @@ DownloadList::receive_exit_input(Input type) { break; default: - throw torrent::client_error("DownloadList::receive_exit_input(...) Invalid input type."); + throw torrent::internal_error("DownloadList::receive_exit_input(...) Invalid input type."); } } catch (torrent::input_error& e) { diff --git a/src/ui/element_chunks_seen.cc b/src/ui/element_chunks_seen.cc index f8d350c3..867921f8 100644 --- a/src/ui/element_chunks_seen.cc +++ b/src/ui/element_chunks_seen.cc @@ -63,7 +63,7 @@ ElementChunksSeen::ElementChunksSeen(core::Download* d) : void ElementChunksSeen::activate(display::Frame* frame, bool focus) { if (is_active()) - throw torrent::client_error("ui::ElementChunksSeen::activate(...) is_active()."); + throw torrent::internal_error("ui::ElementChunksSeen::activate(...) is_active()."); if (focus) control->input()->push_back(&m_bindings); @@ -78,7 +78,7 @@ ElementChunksSeen::activate(display::Frame* frame, bool focus) { void ElementChunksSeen::disable() { if (!is_active()) - throw torrent::client_error("ui::ElementChunksSeen::disable(...) !is_active()."); + throw torrent::internal_error("ui::ElementChunksSeen::disable(...) !is_active()."); control->input()->erase(&m_bindings); @@ -110,7 +110,7 @@ ElementChunksSeen::window() { void ElementChunksSeen::receive_next() { if (m_window == NULL) - throw torrent::client_error("ui::ElementChunksSeen::receive_next(...) called on a disabled object"); + throw torrent::internal_error("ui::ElementChunksSeen::receive_next(...) called on a disabled object"); if (++m_focus > m_window->max_focus()) m_focus = 0; @@ -121,7 +121,7 @@ ElementChunksSeen::receive_next() { void ElementChunksSeen::receive_prev() { if (m_window == NULL) - throw torrent::client_error("ui::ElementChunksSeen::receive_prev(...) called on a disabled object"); + throw torrent::internal_error("ui::ElementChunksSeen::receive_prev(...) called on a disabled object"); if (m_focus > 0) --m_focus; @@ -134,7 +134,7 @@ ElementChunksSeen::receive_prev() { void ElementChunksSeen::receive_pagenext() { if (m_window == NULL) - throw torrent::client_error("ui::ElementChunksSeen::receive_pagenext(...) called on a disabled object"); + throw torrent::internal_error("ui::ElementChunksSeen::receive_pagenext(...) called on a disabled object"); unsigned int visible = m_window->height() - 1; unsigned int scrollable = std::max(m_window->rows() - visible, 0); @@ -152,7 +152,7 @@ ElementChunksSeen::receive_pagenext() { void ElementChunksSeen::receive_pageprev() { if (m_window == NULL) - throw torrent::client_error("ui::ElementChunksSeen::receive_pageprev(...) called on a disabled object"); + throw torrent::internal_error("ui::ElementChunksSeen::receive_pageprev(...) called on a disabled object"); unsigned int visible = m_window->height() - 1; unsigned int scrollable = std::max(m_window->rows() - visible, 0); diff --git a/src/ui/element_download_list.cc b/src/ui/element_download_list.cc index 1d1f7891..21b93df8 100644 --- a/src/ui/element_download_list.cc +++ b/src/ui/element_download_list.cc @@ -59,7 +59,7 @@ ElementDownloadList::ElementDownloadList() : receive_change_view("main"); if (m_view == NULL) - throw torrent::client_error("View \"main\" must be present to initialize the main display."); + throw torrent::internal_error("View \"main\" must be present to initialize the main display."); m_bindings['\x13'] = sigc::mem_fun(*this, &ElementDownloadList::receive_start_download); m_bindings['\x04'] = sigc::mem_fun(*this, &ElementDownloadList::receive_stop_download); @@ -85,7 +85,7 @@ ElementDownloadList::ElementDownloadList() : void ElementDownloadList::activate(display::Frame* frame, bool focus) { if (is_active()) - throw torrent::client_error("ui::ElementDownloadList::activate(...) is_active()."); + throw torrent::internal_error("ui::ElementDownloadList::activate(...) is_active()."); control->input()->push_back(&m_bindings); @@ -100,7 +100,7 @@ ElementDownloadList::activate(display::Frame* frame, bool focus) { void ElementDownloadList::disable() { if (!is_active()) - throw torrent::client_error("ui::ElementDownloadList::disable(...) !is_active()."); + throw torrent::internal_error("ui::ElementDownloadList::disable(...) !is_active()."); control->input()->erase(&m_bindings); diff --git a/src/ui/element_file_list.cc b/src/ui/element_file_list.cc index f8131a55..342ebda9 100644 --- a/src/ui/element_file_list.cc +++ b/src/ui/element_file_list.cc @@ -69,7 +69,7 @@ ElementFileList::ElementFileList(core::Download* d) : void ElementFileList::activate(display::Frame* frame, bool focus) { if (m_window != NULL) - throw torrent::client_error("ui::ElementFileList::activate(...) is_active()."); + throw torrent::internal_error("ui::ElementFileList::activate(...) is_active()."); if (focus) control->input()->push_back(&m_bindings); @@ -86,7 +86,7 @@ ElementFileList::activate(display::Frame* frame, bool focus) { void ElementFileList::disable() { if (m_window == NULL) - throw torrent::client_error("ui::ElementFileList::disable(...) !is_active()."); + throw torrent::internal_error("ui::ElementFileList::disable(...) !is_active()."); control->input()->erase(&m_bindings); @@ -105,7 +105,7 @@ ElementFileList::window() { void ElementFileList::receive_next() { if (m_window == NULL) - throw torrent::client_error("ui::ElementFileList::receive_next(...) called on a disabled object"); + throw torrent::internal_error("ui::ElementFileList::receive_next(...) called on a disabled object"); if (++m_focus >= m_download->download()->file_list()->size_files()) m_focus = 0; @@ -116,7 +116,7 @@ ElementFileList::receive_next() { void ElementFileList::receive_prev() { if (m_window == NULL) - throw torrent::client_error("ui::ElementFileList::receive_prev(...) called on a disabled object"); + throw torrent::internal_error("ui::ElementFileList::receive_prev(...) called on a disabled object"); torrent::FileList* fl = m_download->download()->file_list(); @@ -134,7 +134,7 @@ ElementFileList::receive_prev() { void ElementFileList::receive_pagenext() { if (m_window == NULL) - throw torrent::client_error("ui::ElementFileList::receive_pagenext(...) called on a disabled object"); + throw torrent::internal_error("ui::ElementFileList::receive_pagenext(...) called on a disabled object"); unsigned int count = (m_window->height() - 1) / 2; torrent::FileList* fl = m_download->download()->file_list(); @@ -152,7 +152,7 @@ ElementFileList::receive_pagenext() { void ElementFileList::receive_pageprev() { if (m_window == NULL) - throw torrent::client_error("ui::ElementFileList::receive_pageprev(...) called on a disabled object"); + throw torrent::internal_error("ui::ElementFileList::receive_pageprev(...) called on a disabled object"); torrent::FileList* fl = m_download->download()->file_list(); @@ -174,7 +174,7 @@ ElementFileList::receive_pageprev() { void ElementFileList::receive_priority() { if (m_window == NULL) - throw torrent::client_error("ui::ElementFileList::receive_prev(...) called on a disabled object"); + throw torrent::internal_error("ui::ElementFileList::receive_prev(...) called on a disabled object"); torrent::FileList* fl = m_download->download()->file_list(); @@ -192,7 +192,7 @@ ElementFileList::receive_priority() { void ElementFileList::receive_change_all() { if (m_window == NULL) - throw torrent::client_error("ui::ElementFileList::receive_prev(...) called on a disabled object"); + throw torrent::internal_error("ui::ElementFileList::receive_prev(...) called on a disabled object"); torrent::FileList* fl = m_download->download()->file_list(); diff --git a/src/ui/element_log_complete.cc b/src/ui/element_log_complete.cc index c26fc567..88751d1c 100644 --- a/src/ui/element_log_complete.cc +++ b/src/ui/element_log_complete.cc @@ -56,7 +56,7 @@ ElementLogComplete::ElementLogComplete(core::Log* l) : void ElementLogComplete::activate(display::Frame* frame, bool focus) { if (is_active()) - throw torrent::client_error("ui::ElementLogComplete::activate(...) is_active()."); + throw torrent::internal_error("ui::ElementLogComplete::activate(...) is_active()."); control->input()->push_back(&m_bindings); @@ -70,7 +70,7 @@ ElementLogComplete::activate(display::Frame* frame, bool focus) { void ElementLogComplete::disable() { if (!is_active()) - throw torrent::client_error("ui::ElementLogComplete::disable(...) !is_active()."); + throw torrent::internal_error("ui::ElementLogComplete::disable(...) !is_active()."); control->input()->erase(&m_bindings); diff --git a/src/ui/element_menu.cc b/src/ui/element_menu.cc index 53a811cd..055ed733 100644 --- a/src/ui/element_menu.cc +++ b/src/ui/element_menu.cc @@ -86,7 +86,7 @@ ElementMenu::~ElementMenu() { void ElementMenu::activate(display::Frame* frame, bool focus) { if (is_active()) - throw torrent::client_error("ui::ElementMenu::activate(...) is_active()."); + throw torrent::internal_error("ui::ElementMenu::activate(...) is_active()."); if (focus) control->input()->push_back(&m_bindings); @@ -103,7 +103,7 @@ ElementMenu::activate(display::Frame* frame, bool focus) { void ElementMenu::disable() { if (!is_active()) - throw torrent::client_error("ui::ElementMenu::disable(...) !is_active()."); + throw torrent::internal_error("ui::ElementMenu::disable(...) !is_active()."); control->input()->erase(&m_bindings); diff --git a/src/ui/element_peer_list.cc b/src/ui/element_peer_list.cc index 6ec355e5..7d8301cc 100644 --- a/src/ui/element_peer_list.cc +++ b/src/ui/element_peer_list.cc @@ -140,7 +140,7 @@ ElementPeerList::create_info() { void ElementPeerList::activate(display::Frame* frame, bool focus) { if (is_active()) - throw torrent::client_error("ui::ElementPeerList::activate(...) is_active()."); + throw torrent::internal_error("ui::ElementPeerList::activate(...) is_active()."); if (focus) control->input()->push_back(&m_bindings); @@ -154,7 +154,7 @@ ElementPeerList::activate(display::Frame* frame, bool focus) { void ElementPeerList::disable() { if (!is_active()) - throw torrent::client_error("ui::ElementPeerList::disable(...) !is_active()."); + throw torrent::internal_error("ui::ElementPeerList::disable(...) !is_active()."); control->input()->erase(&m_bindings); @@ -240,7 +240,7 @@ ElementPeerList::receive_peer_disconnected(torrent::Peer p) { PList::iterator itr = std::find(m_list.begin(), m_list.end(), p); if (itr == m_list.end()) - throw torrent::client_error("ElementPeerList::receive_peer_disconnected(...) itr == m_list.end()."); + throw torrent::internal_error("ElementPeerList::receive_peer_disconnected(...) itr == m_list.end()."); if (itr == m_listItr) m_listItr = m_list.erase(itr); diff --git a/src/ui/element_string_list.cc b/src/ui/element_string_list.cc index 59b0be5a..291c7977 100644 --- a/src/ui/element_string_list.cc +++ b/src/ui/element_string_list.cc @@ -53,7 +53,7 @@ ElementStringList::ElementStringList() : void ElementStringList::activate(display::Frame* frame, bool focus) { if (is_active()) - throw torrent::client_error("ui::ElementStringList::activate(...) is_active()."); + throw torrent::internal_error("ui::ElementStringList::activate(...) is_active()."); control->input()->push_back(&m_bindings); @@ -67,7 +67,7 @@ ElementStringList::activate(display::Frame* frame, bool focus) { void ElementStringList::disable() { if (!is_active()) - throw torrent::client_error("ui::ElementStringList::disable(...) !is_active()."); + throw torrent::internal_error("ui::ElementStringList::disable(...) !is_active()."); control->input()->erase(&m_bindings); diff --git a/src/ui/element_text.cc b/src/ui/element_text.cc index 8ad19c5e..c9176d08 100644 --- a/src/ui/element_text.cc +++ b/src/ui/element_text.cc @@ -68,7 +68,7 @@ ElementText::~ElementText() { void ElementText::activate(display::Frame* frame, bool focus) { if (is_active()) - throw torrent::client_error("ui::ElementText::activate(...) is_active()."); + throw torrent::internal_error("ui::ElementText::activate(...) is_active()."); if (focus) control->input()->push_back(&m_bindings); @@ -84,7 +84,7 @@ ElementText::activate(display::Frame* frame, bool focus) { void ElementText::disable() { if (!is_active()) - throw torrent::client_error("ui::ElementText::disable(...) !is_active()."); + throw torrent::internal_error("ui::ElementText::disable(...) !is_active()."); control->input()->erase(&m_bindings); diff --git a/src/ui/element_tracker_list.cc b/src/ui/element_tracker_list.cc index a978ba2b..32a8b087 100644 --- a/src/ui/element_tracker_list.cc +++ b/src/ui/element_tracker_list.cc @@ -66,7 +66,7 @@ ElementTrackerList::ElementTrackerList(core::Download* d) : void ElementTrackerList::activate(display::Frame* frame, bool focus) { if (m_window != NULL) - throw torrent::client_error("ui::ElementTrackerList::activate(...) is_active()."); + throw torrent::internal_error("ui::ElementTrackerList::activate(...) is_active()."); if (focus) control->input()->push_back(&m_bindings); @@ -81,7 +81,7 @@ ElementTrackerList::activate(display::Frame* frame, bool focus) { void ElementTrackerList::disable() { if (m_window == NULL) - throw torrent::client_error("ui::ElementTrackerList::disable(...) !is_active()."); + throw torrent::internal_error("ui::ElementTrackerList::disable(...) !is_active()."); control->input()->erase(&m_bindings); @@ -100,7 +100,7 @@ ElementTrackerList::window() { void ElementTrackerList::receive_disable() { if (m_window == NULL) - throw torrent::client_error("ui::ElementTrackerList::receive_disable(...) called on a disabled object"); + throw torrent::internal_error("ui::ElementTrackerList::receive_disable(...) called on a disabled object"); torrent::Tracker t = m_download->download()->tracker_list().get(m_focus); @@ -115,7 +115,7 @@ ElementTrackerList::receive_disable() { void ElementTrackerList::receive_next() { if (m_window == NULL) - throw torrent::client_error("ui::ElementTrackerList::receive_next(...) called on a disabled object"); + throw torrent::internal_error("ui::ElementTrackerList::receive_next(...) called on a disabled object"); if (++m_focus >= m_download->download()->tracker_list().size()) m_focus = 0; @@ -126,7 +126,7 @@ ElementTrackerList::receive_next() { void ElementTrackerList::receive_prev() { if (m_window == NULL) - throw torrent::client_error("ui::ElementTrackerList::receive_prev(...) called on a disabled object"); + throw torrent::internal_error("ui::ElementTrackerList::receive_prev(...) called on a disabled object"); if (m_download->download()->tracker_list().size() == 0) return; @@ -142,12 +142,12 @@ ElementTrackerList::receive_prev() { void ElementTrackerList::receive_cycle_group() { if (m_window == NULL) - throw torrent::client_error("ui::ElementTrackerList::receive_group_cycle(...) called on a disabled object"); + throw torrent::internal_error("ui::ElementTrackerList::receive_group_cycle(...) called on a disabled object"); torrent::TrackerList tl = m_download->download()->tracker_list(); if (m_focus >= tl.size()) - throw torrent::client_error("ui::ElementTrackerList::receive_group_cycle(...) called with an invalid focus"); + throw torrent::internal_error("ui::ElementTrackerList::receive_group_cycle(...) called with an invalid focus"); tl.cycle_group(tl.get(m_focus).group()); diff --git a/src/ui/element_transfer_list.cc b/src/ui/element_transfer_list.cc index ab113692..a3d09cce 100644 --- a/src/ui/element_transfer_list.cc +++ b/src/ui/element_transfer_list.cc @@ -63,7 +63,7 @@ ElementTransferList::ElementTransferList(core::Download* d) : void ElementTransferList::activate(display::Frame* frame, bool focus) { if (is_active()) - throw torrent::client_error("ui::ElementTransferList::activate(...) is_active()."); + throw torrent::internal_error("ui::ElementTransferList::activate(...) is_active()."); if (focus) control->input()->push_back(&m_bindings); @@ -78,7 +78,7 @@ ElementTransferList::activate(display::Frame* frame, bool focus) { void ElementTransferList::disable() { if (!is_active()) - throw torrent::client_error("ui::ElementTransferList::disable(...) !is_active()."); + throw torrent::internal_error("ui::ElementTransferList::disable(...) !is_active()."); control->input()->erase(&m_bindings); @@ -110,7 +110,7 @@ ElementTransferList::window() { void ElementTransferList::receive_next() { if (m_window == NULL) - throw torrent::client_error("ui::ElementTransferList::receive_next(...) called on a disabled object"); + throw torrent::internal_error("ui::ElementTransferList::receive_next(...) called on a disabled object"); if (++m_focus > m_window->max_focus()) m_focus = 0; @@ -121,7 +121,7 @@ ElementTransferList::receive_next() { void ElementTransferList::receive_prev() { if (m_window == NULL) - throw torrent::client_error("ui::ElementTransferList::receive_prev(...) called on a disabled object"); + throw torrent::internal_error("ui::ElementTransferList::receive_prev(...) called on a disabled object"); if (m_focus > 0) --m_focus; @@ -134,7 +134,7 @@ ElementTransferList::receive_prev() { void ElementTransferList::receive_pagenext() { if (m_window == NULL) - throw torrent::client_error("ui::ElementTransferList::receive_pagenext(...) called on a disabled object"); + throw torrent::internal_error("ui::ElementTransferList::receive_pagenext(...) called on a disabled object"); unsigned int visible = m_window->height() - 1; unsigned int scrollable = std::max(m_window->rows() - visible, 0); @@ -152,7 +152,7 @@ ElementTransferList::receive_pagenext() { void ElementTransferList::receive_pageprev() { if (m_window == NULL) - throw torrent::client_error("ui::ElementTransferList::receive_pageprev(...) called on a disabled object"); + throw torrent::internal_error("ui::ElementTransferList::receive_pageprev(...) called on a disabled object"); unsigned int visible = m_window->height() - 1; unsigned int scrollable = std::max(m_window->rows() - visible, 0); diff --git a/src/ui/root.cc b/src/ui/root.cc index 1633f34f..e93ca604 100644 --- a/src/ui/root.cc +++ b/src/ui/root.cc @@ -194,7 +194,7 @@ Root::adjust_up_throttle(int throttle) { void Root::enable_input(const std::string& title, input::TextInput* input) { if (m_windowInput->input() != NULL) - throw torrent::client_error("Root::enable_input(...) m_windowInput->input() != NULL."); + throw torrent::internal_error("Root::enable_input(...) m_windowInput->input() != NULL."); input->slot_dirty(sigc::mem_fun(m_windowInput, &WInput::mark_dirty)); @@ -215,7 +215,7 @@ Root::enable_input(const std::string& title, input::TextInput* input) { void Root::disable_input() { if (m_windowInput->input() == NULL) - throw torrent::client_error("Root::disable_input() m_windowInput->input() == NULL."); + throw torrent::internal_error("Root::disable_input() m_windowInput->input() == NULL."); m_windowInput->input()->slot_dirty(sigc::slot0()); diff --git a/src/utils/variable_map.cc b/src/utils/variable_map.cc index 28cbda23..ee8f36a3 100644 --- a/src/utils/variable_map.cc +++ b/src/utils/variable_map.cc @@ -59,7 +59,7 @@ VariableMap::insert(const std::string& key, Variable* v) { iterator itr = base_type::find(key); if (itr != base_type::end()) - throw torrent::client_error("VariableMap::insert(...) tried to insert an already existing key."); + throw torrent::internal_error("VariableMap::insert(...) tried to insert an already existing key."); base_type::insert(itr, value_type(key, v)); }