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

realm / realm-core / github_pull_request_312964

19 Feb 2025 07:31PM UTC coverage: 90.814% (-0.3%) from 91.119%
github_pull_request_312964

Pull #8071

Evergreen

web-flow
Bump serialize-javascript and mocha

Bumps [serialize-javascript](https://github.com/yahoo/serialize-javascript) to 6.0.2 and updates ancestor dependency [mocha](https://github.com/mochajs/mocha). These dependencies need to be updated together.


Updates `serialize-javascript` from 6.0.0 to 6.0.2
- [Release notes](https://github.com/yahoo/serialize-javascript/releases)
- [Commits](https://github.com/yahoo/serialize-javascript/compare/v6.0.0...v6.0.2)

Updates `mocha` from 10.2.0 to 10.8.2
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v10.2.0...v10.8.2)

---
updated-dependencies:
- dependency-name: serialize-javascript
  dependency-type: indirect
- dependency-name: mocha
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #8071: Bump serialize-javascript and mocha

96552 of 179126 branches covered (53.9%)

212672 of 234185 relevant lines covered (90.81%)

3115802.0 hits per line

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

90.74
/src/realm/exceptions.cpp
1
/*************************************************************************
2
 *
3
 * Copyright 2016 Realm Inc.
4
 *
5
 * Licensed under the Apache License, Version 2.0 (the "License");
6
 * you may not use this file except in compliance with the License.
7
 * You may obtain a copy of the License at
8
 *
9
 * http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 *
17
 **************************************************************************/
18

19
#include <realm/exceptions.hpp>
20

21
#include <realm/version.hpp>
22
#include <realm/util/to_string.hpp>
23
#include <realm/util/demangle.hpp>
24

25
namespace realm {
26

27
const char* Exception::what() const noexcept
28
{
6,066✔
29
    return reason().data();
6,066✔
30
}
6,066✔
31

32
const Status& Exception::to_status() const
33
{
687✔
34
    return m_status;
687✔
35
}
687✔
36

37
std::string_view Exception::reason() const noexcept
38
{
7,485✔
39
    return m_status.reason();
7,485✔
40
}
7,485✔
41

42
ErrorCodes::Error Exception::code() const noexcept
43
{
6,714✔
44
    return m_status.code();
6,714✔
45
}
6,714✔
46

47
ErrorCategory Exception::category() const noexcept
48
{
×
49
    return ErrorCodes::error_categories(code());
×
50
}
×
51

52
std::string_view Exception::code_string() const noexcept
53
{
573✔
54
    return m_status.code_string();
573✔
55
}
573✔
56

57
Exception::Exception(ErrorCodes::Error err, std::string_view str)
58
    : m_status(err, str)
9,846✔
59
{
9,846✔
60
}
9,846✔
61

62
Exception::Exception(Status status)
63
    : m_status(std::move(status))
576✔
64
{
576✔
65
}
576✔
66

67
// Apple implementation in exceptions.mm
68
#if !REALM_PLATFORM_APPLE
69
Status exception_to_status() noexcept
70
{
426✔
71
    try {
426✔
72
        throw;
426✔
73
    }
426✔
74
    catch (const Exception& e) {
426✔
75
        return e.to_status();
420✔
76
    }
420✔
77
    catch (const std::exception& e) {
426✔
78
        return Status(ErrorCodes::UnknownError,
6✔
79
                      util::format("Caught std::exception of type %1: %2", util::get_type_name(e), e.what()));
6✔
80
    }
6✔
81
    catch (...) {
426✔
82
        REALM_UNREACHABLE();
83
    }
×
84
}
426✔
85
#endif // !REALM_PLATFORM_APPLE
86

87
UnsupportedFileFormatVersion::UnsupportedFileFormatVersion(int version)
88
    : Exception(ErrorCodes::UnsupportedFileFormatVersion,
6✔
89
                util::format("Database has an unsupported version (%1) and cannot be upgraded", version))
6✔
90
    , source_version(version)
6✔
91
{
6✔
92
}
6✔
93
UnsupportedFileFormatVersion::~UnsupportedFileFormatVersion() noexcept = default;
6✔
94

95

96
LogicError::LogicError(ErrorCodes::Error code, std::string_view msg)
97
    : Exception(code, msg)
8,022✔
98
{
8,022✔
99
    REALM_ASSERT(ErrorCodes::error_categories(code).test(ErrorCategory::logic_error));
8,022✔
100
}
8,022✔
101
LogicError::~LogicError() noexcept = default;
8,022✔
102

103

104
RuntimeError::RuntimeError(ErrorCodes::Error code, std::string_view msg)
105
    : Exception(code, msg)
579✔
106
{
579✔
107
    REALM_ASSERT(ErrorCodes::error_categories(code).test(ErrorCategory::runtime_error));
579✔
108
}
579✔
109
RuntimeError::RuntimeError(Status&& status)
110
    : Exception(std::move(status))
30✔
111
{
30✔
112
    REALM_ASSERT(ErrorCodes::error_categories(to_status().code()).test(ErrorCategory::runtime_error));
30✔
113
}
30✔
114
RuntimeError::~RuntimeError() noexcept = default;
609✔
115

116
InvalidArgument::InvalidArgument(std::string_view msg)
117
    : InvalidArgument(ErrorCodes::InvalidArgument, msg)
366✔
118
{
366✔
119
}
366✔
120

121
InvalidArgument::InvalidArgument(ErrorCodes::Error code, std::string_view msg)
122
    : LogicError(code, msg)
3,432✔
123
{
3,432✔
124
    REALM_ASSERT(ErrorCodes::error_categories(code).test(ErrorCategory::invalid_argument));
3,432✔
125
}
3,432✔
126
InvalidArgument::~InvalidArgument() noexcept = default;
3,432✔
127

128

129
OutOfBounds::OutOfBounds(std::string_view msg, size_t idx, size_t sz)
130
    : InvalidArgument(ErrorCodes::OutOfBounds,
417✔
131
                      sz == 0 ? util::format("Requested index %1 calling %2 when empty", idx, msg)
417✔
132
                              : util::format("Requested index %1 calling %2 when max is %3", idx, msg, sz - 1))
417✔
133
    , index(idx)
417✔
134
    , size(sz)
417✔
135
{
417✔
136
}
417✔
137
OutOfBounds::~OutOfBounds() noexcept = default;
417✔
138

139

140
FileAccessError::FileAccessError(ErrorCodes::Error code, std::string_view msg, std::string_view path, int err)
141
    : RuntimeError(code, msg)
507✔
142
    , m_path(path)
507✔
143
    , m_errno(err)
507✔
144
{
507✔
145
    REALM_ASSERT(ErrorCodes::error_categories(code).test(ErrorCategory::file_access));
507✔
146
}
507✔
147
FileAccessError::~FileAccessError() noexcept = default;
507✔
148

149
// Out-of-line virtual destructors for each of the exception types "anchors"
150
// the vtable and makes it so that it doesn't have to be emitted into each TU
151
// which uses the exception type
152
KeyAlreadyUsed::~KeyAlreadyUsed() noexcept = default;
12✔
153
MaximumFileSizeExceeded::~MaximumFileSizeExceeded() noexcept = default;
×
154
OutOfDiskSpace::~OutOfDiskSpace() noexcept = default;
×
155
MultipleSyncAgents::~MultipleSyncAgents() noexcept = default;
9✔
156
AddressSpaceExhausted::~AddressSpaceExhausted() noexcept = default;
×
157
InvalidColumnKey::~InvalidColumnKey() noexcept = default;
174✔
158
NoSuchTable::~NoSuchTable() noexcept = default;
27✔
159
TableNameInUse::~TableNameInUse() noexcept = default;
6✔
160
KeyNotFound::~KeyNotFound() noexcept = default;
432✔
161
NotNullable::~NotNullable() noexcept = default;
39✔
162
PropertyTypeMismatch::~PropertyTypeMismatch() noexcept = default;
30✔
163
InvalidEncryptionKey::~InvalidEncryptionKey() noexcept = default;
6✔
164
StaleAccessor::~StaleAccessor() noexcept = default;
99✔
165
IllegalOperation::~IllegalOperation() noexcept = default;
2,226✔
166
NoSubscriptionForWrite::~NoSubscriptionForWrite() noexcept = default;
3✔
167
WrongTransactionState::~WrongTransactionState() noexcept = default;
513✔
168
InvalidTableRef::~InvalidTableRef() noexcept = default;
21✔
169
SerializationError::~SerializationError() noexcept = default;
×
170
NotImplemented::~NotImplemented() noexcept = default;
×
171
MigrationFailed::~MigrationFailed() noexcept = default;
15✔
172
SyncSchemaMigrationFailed::~SyncSchemaMigrationFailed() noexcept = default;
×
173
ObjectAlreadyExists::~ObjectAlreadyExists() noexcept = default;
12✔
174
CrossTableLinkTarget::~CrossTableLinkTarget() noexcept = default;
9✔
175
SystemError::~SystemError() noexcept = default;
18✔
176
query_parser::SyntaxError::~SyntaxError() noexcept = default;
558✔
177
query_parser::InvalidQueryError::~InvalidQueryError() noexcept = default;
906✔
178
query_parser::InvalidQueryArgError::~InvalidQueryArgError() noexcept = default;
213✔
179

180
} // namespace realm
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

© 2025 Coveralls, Inc