123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- // Copyright (c) 2014-2021 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, ARISING 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
- #include <xlnt/utils/exceptions.hpp>
- namespace xlnt {
- exception::exception(const std::string &message)
- : std::runtime_error("xlnt::exception : " + message)
- {
- this->message(message);
- }
- exception::~exception() = default;
- void exception::message(const std::string &message)
- {
- message_ = message;
- }
- std::string exception::message()
- {
- return message_;
- }
- unhandled_switch_case::unhandled_switch_case()
- : xlnt::exception("unhandled switch case")
- {
- }
- unhandled_switch_case::~unhandled_switch_case()
- {
- }
- invalid_sheet_title::invalid_sheet_title(const std::string &title)
- : exception(std::string("bad worksheet title: ") + title)
- {
- }
- invalid_sheet_title::~invalid_sheet_title()
- {
- }
- invalid_column_index::invalid_column_index()
- : exception("column string index error")
- {
- }
- invalid_column_index::~invalid_column_index()
- {
- }
- invalid_data_type::invalid_data_type()
- : exception("data type error")
- {
- }
- invalid_data_type::~invalid_data_type()
- {
- }
- invalid_file::invalid_file(const std::string &filename)
- : exception(std::string("couldn't open file: (") + filename + ")")
- {
- }
- invalid_file::~invalid_file()
- {
- }
- 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) + ")")
- {
- }
- invalid_cell_reference::invalid_cell_reference(const std::string &coord_string)
- : exception(std::string("bad cell coordinates: (") + (coord_string.empty() ? "<empty>" : coord_string) + ")")
- {
- }
- invalid_cell_reference::~invalid_cell_reference()
- {
- }
- illegal_character::illegal_character(char c)
- : exception(std::string("illegal character: (") + std::to_string(static_cast<unsigned char>(c)) + ")")
- {
- }
- illegal_character::~illegal_character()
- {
- }
- invalid_parameter::invalid_parameter()
- : exception("invalid parameter")
- {
- }
- invalid_parameter::~invalid_parameter()
- {
- }
- invalid_attribute::invalid_attribute()
- : exception("bad attribute")
- {
- }
- invalid_attribute::~invalid_attribute()
- {
- }
- key_not_found::key_not_found()
- : exception("key not found in container")
- {
- }
- key_not_found::~key_not_found()
- {
- }
- no_visible_worksheets::no_visible_worksheets()
- : exception("workbook needs at least one non-hidden worksheet to be saved")
- {
- }
- no_visible_worksheets::~no_visible_worksheets()
- {
- }
- unsupported::unsupported(const std::string &message)
- : exception(message)
- {
- }
- unsupported::~unsupported()
- {
- }
- } // namespace xlnt
|