xlnt/source/utils/exceptions.cpp

163 lines
3.7 KiB
C++
Raw Normal View History

2017-01-03 09:35:18 +08:00
// Copyright (c) 2014-2017 Thomas Fussell
// Copyright (c) 2010-2015 openpyxl
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, WRISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE
//
// @license: http://www.opensource.org/licenses/mit-license.php
// @author: see AUTHORS file
2016-07-22 11:04:36 +08:00
#include <xlnt/utils/exceptions.hpp>
2014-05-22 05:48:51 +08:00
namespace xlnt {
2016-07-30 06:55:49 +08:00
exception::exception(const std::string &message)
2016-07-22 11:04:36 +08:00
: std::runtime_error("xlnt::error : " + message)
2014-06-06 05:42:15 +08:00
{
this->message(message);
2014-06-06 05:42:15 +08:00
}
exception::~exception()
{
}
void exception::message(const std::string &message)
2014-06-06 05:42:15 +08:00
{
2016-07-22 11:04:36 +08:00
message_ = message;
2014-06-06 05:42:15 +08:00
}
missing_number_format::~missing_number_format()
{
}
unhandled_switch_case::unhandled_switch_case()
: xlnt::exception("unhandled switch case")
{
}
unhandled_switch_case::~unhandled_switch_case()
{
}
2016-07-30 06:55:49 +08:00
invalid_sheet_title::invalid_sheet_title(const std::string &title)
: exception(std::string("bad worksheet title: ") + title)
2016-07-22 11:04:36 +08:00
{
}
invalid_sheet_title::~invalid_sheet_title()
{
}
2016-07-30 06:55:49 +08:00
invalid_column_string_index::invalid_column_string_index()
: exception("column string index error")
2016-07-22 11:04:36 +08:00
{
}
invalid_column_string_index::~invalid_column_string_index()
{
}
2016-07-30 06:55:49 +08:00
invalid_data_type::invalid_data_type()
: exception("data type error")
{
}
invalid_data_type::~invalid_data_type()
{
}
2016-07-30 06:55:49 +08:00
invalid_file::invalid_file(const std::string &filename)
: exception(std::string("couldn't open file: (") + filename + ")")
2014-07-20 04:59:05 +08:00
{
}
invalid_file::~invalid_file()
{
}
2016-07-30 06:55:49 +08:00
invalid_cell_reference::invalid_cell_reference(column_t column, row_t row)
: exception(
std::string("bad cell coordinates: (") + std::to_string(column.index) + ", " + std::to_string(row) + ")")
2014-05-22 05:48:51 +08:00
{
}
2016-07-30 06:55:49 +08:00
invalid_cell_reference::invalid_cell_reference(const std::string &coord_string)
: exception(std::string("bad cell coordinates: (") + (coord_string.empty() ? "<empty>" : coord_string) + ")")
2015-11-23 01:41:27 +08:00
{
}
invalid_cell_reference::~invalid_cell_reference()
{
}
2016-07-30 06:55:49 +08:00
illegal_character::illegal_character(char c)
: exception(std::string("illegal character: (") + std::to_string(static_cast<unsigned char>(c)) + ")")
2015-11-23 01:41:27 +08:00
{
}
illegal_character::~illegal_character()
{
}
2016-07-30 06:55:49 +08:00
invalid_parameter::invalid_parameter()
: exception("invalid parameter")
{
}
invalid_parameter::~invalid_parameter()
{
}
2016-07-30 06:55:49 +08:00
invalid_attribute::invalid_attribute()
: exception("bad attribute")
2016-03-06 10:39:50 +08:00
{
}
invalid_attribute::~invalid_attribute()
{
}
2016-07-30 06:55:49 +08:00
key_not_found::key_not_found()
: exception("key not found in container")
2016-07-22 11:04:36 +08:00
{
}
key_not_found::~key_not_found()
{
}
2016-07-30 06:55:49 +08:00
no_visible_worksheets::no_visible_worksheets()
: exception("workbook needs at least one non-hidden worksheet to be saved")
2016-03-06 10:39:50 +08:00
{
}
no_visible_worksheets::~no_visible_worksheets()
{
}
unsupported::unsupported(const std::string &message)
: exception(message)
{
}
unsupported::~unsupported()
{
}
2014-05-22 05:48:51 +08:00
} // namespace xlnt