| 137 | } |
| 138 | |
| 139 | Error Error::flatten() const { |
| 140 | if (_storage == nullptr || _storage->cause == nullptr) { |
| 141 | return *this; |
| 142 | } |
| 143 | |
| 144 | auto message = toString(false); |
| 145 | StringBox stacktrace; |
| 146 | |
| 147 | auto current = _storage; |
| 148 | while (current != nullptr && stacktrace.isEmpty()) { |
| 149 | stacktrace = current->stackTrace; |
| 150 | current = current->cause; |
| 151 | } |
| 152 | |
| 153 | return Error(StringCache::getGlobal().makeString(std::move(message)), std::move(stacktrace), nullptr); |
| 154 | } |
| 155 | |
| 156 | bool Error::operator==(const Error& other) const noexcept { |
| 157 | if (_storage != nullptr && other._storage != nullptr) { |
no test coverage detected