• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

xlnt-community / xlnt / 64b9f05e-ec52-42bc-9eea-f572541cc6cb

27 Jan 2026 08:37PM UTC coverage: 83.928% (+1.1%) from 82.793%
64b9f05e-ec52-42bc-9eea-f572541cc6cb

Pull #87

circleci

doomlaur
Move specifications to their own section in CONTRIBUTING.md
Pull Request #87: Improve documentation when exceptions are thrown (fixes #81)

15263 of 19954 branches covered (76.49%)

722 of 901 new or added lines in 37 files covered. (80.13%)

15 existing lines in 5 files now uncovered.

12491 of 14883 relevant lines covered (83.93%)

12216.5 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

67.14
./source/utils/exceptions.cpp
1
// Copyright (c) 2014-2022 Thomas Fussell
2
// Copyright (c) 2010-2015 openpyxl
3
// Copyright (c) 2024-2025 xlnt-community
4
//
5
// Permission is hereby granted, free of charge, to any person obtaining a copy
6
// of this software and associated documentation files (the "Software"), to deal
7
// in the Software without restriction, including without limitation the rights
8
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
// copies of the Software, and to permit persons to whom the Software is
10
// furnished to do so, subject to the following conditions:
11
//
12
// The above copyright notice and this permission notice shall be included in
13
// all copies or substantial portions of the Software.
14
//
15
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
// THE SOFTWARE
22
//
23
// @license: http://www.opensource.org/licenses/mit-license.php
24
// @author: see AUTHORS file
25

26
#include <xlnt/utils/exceptions.hpp>
27

28
namespace xlnt {
29

30
exception::exception(const std::string &message)
481✔
31
    : std::runtime_error("xlnt::exception : " + message)
481✔
32
    , message_(message)
962✔
33
{
34
}
481✔
35

UNCOV
36
void exception::message(const std::string &message)
×
37
{
UNCOV
38
    message_ = message;
×
UNCOV
39
}
×
40

41
const std::string & exception::message()
×
42
{
43
    return message_;
×
44
}
45

NEW
46
unhandled_switch_case::unhandled_switch_case(long long switch_value)
×
NEW
47
    : xlnt::exception("unhandled switch case " + std::to_string(switch_value))
×
48
{
49
}
×
50

NEW
51
unhandled_switch_case::unhandled_switch_case(const std::string &switch_value_string)
×
NEW
52
    : xlnt::exception("unhandled switch case " + switch_value_string)
×
53
{
54
}
×
55

NEW
56
unhandled_switch_case::unhandled_switch_case(const char *switch_value_optional_string)
×
NEW
57
    : xlnt::exception(switch_value_optional_string != nullptr ? ("unhandled switch case " + std::string(switch_value_optional_string)) : "unhandled switch case")
×
58
{
UNCOV
59
}
×
60

61
invalid_sheet_title::invalid_sheet_title(const std::string &title)
12✔
62
    : exception("bad worksheet title: " + title)
12✔
63
{
64
}
12✔
65

66
invalid_column_index::invalid_column_index(column_t::index_t column_index)
2✔
67
    : exception("column at index " + std::to_string(column_index) + " does not exist")
2✔
68
{
69

70
}
2✔
71

NEW
72
invalid_column_index::invalid_column_index(column_t column)
×
NEW
73
    : exception("column at index " + std::to_string(column.index) + " does not exist")
×
74
{
UNCOV
75
}
×
76

77
invalid_column_index::invalid_column_index(const std::string &column_str)
2✔
78
    : exception("column string \"" + column_str + "\" is invalid")
2✔
79
{
80
}
2✔
81

82
invalid_data_type::invalid_data_type(const std::string &type)
2✔
83
    : exception("data type error for type \"" + type + "\"")
2✔
84
{
85
}
2✔
86

87
invalid_file::invalid_file(const std::string &reason)
19✔
88
    : exception("couldn't load file, reason given: " + reason)
19✔
89
{
90
}
19✔
91

92
invalid_cell_reference::invalid_cell_reference(column_t column, row_t row)
1✔
93
    : exception(
94
        std::string("bad cell coordinates: (") + std::to_string(column.index) + ", " + std::to_string(row) + ")")
3✔
95
{
96
}
1✔
97

98
invalid_cell_reference::invalid_cell_reference(const std::string &coord_string)
18✔
99
    : exception(std::string("bad cell coordinates: (") + (coord_string.empty() ? "<empty>" : coord_string) + ")")
57!
100
{
101
}
18✔
102

103
illegal_character::illegal_character(char c)
29✔
104
    : exception(std::string("illegal character: (") + std::to_string(static_cast<unsigned char>(c)) + ")")
87✔
105
{
106
}
29✔
107

108
invalid_parameter::invalid_parameter(const std::string &message)
69✔
109
    : exception("invalid parameter: " + message)
69✔
110
{
111
}
69✔
112

113
invalid_attribute::invalid_attribute(const std::string &message)
110✔
114
    : exception("invalid attribute: " + message)
110✔
115
{
116
}
110✔
117

118
key_not_found::key_not_found(const std::string &key_name)
30✔
119
    : exception("key \"" + key_name + "\" not found in container")
30✔
120
{
121
}
30✔
122

123
no_visible_worksheets::no_visible_worksheets()
×
124
    : exception("workbook needs at least one non-hidden worksheet to be saved")
×
125
{
126
}
×
127

128
invalid_password::invalid_password(const std::string &message)
23✔
129
    : exception("invalid password: " + message)
23✔
130
{
131
}
23✔
132

133
unsupported::unsupported(const std::string &message)
×
NEW
134
    : exception("unsupported: " + message)
×
135
{
NEW
136
}
×
137

138
encoding_error::encoding_error(const std::string &message)
1✔
139
    : exception("encoding error: " + message)
1✔
140
{
141
}
1✔
142

143
bad_variant_access::bad_variant_access(variant::type expected_type, variant::type actual_type)
132✔
144
    : exception("bad variant access: expected type " + xlnt::variant::get_type_string(expected_type) +
264✔
145
        " but got type " + xlnt::variant::get_type_string(actual_type))
396✔
146
{
147
}
132✔
148

149
} // namespace xlnt
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc