Repository navigation
Commit 64cac39
fix: bad_expected_access::what() returns the error message (#1269)
* fix: bad_expected_access::what() returns the error message (#1263)
what() returned a fixed "bad_expected_access", so the actual error of a
failed Expected<T> was lost. When the error type converts to std::string,
the message is now returned instead. It is stored in a shared_ptr so that
copying the exception does not allocate.
* simplify bad_expected_access::what(): reuse m_error instead of a second copy
Return m_error.c_str() through an overload on std::string, with a generic
fallback for other error types. No extra member, so the class layout is
unchanged, and copying the exception no longer copies the message twice.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Davide Faconti <davide.faconti@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>1 parent 726c857 commit 64cac39
2 files changed
Lines changed: 57 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
| 261 | + | |
261 | 262 | | |
262 | 263 | | |
263 | 264 | | |
| |||
1607 | 1608 | | |
1608 | 1609 | | |
1609 | 1610 | | |
| 1611 | + | |
1610 | 1612 | | |
1611 | 1613 | | |
1612 | | - | |
| 1614 | + | |
1613 | 1615 | | |
1614 | 1616 | | |
1615 | 1617 | | |
| |||
1637 | 1639 | | |
1638 | 1640 | | |
1639 | 1641 | | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
1640 | 1653 | | |
1641 | 1654 | | |
1642 | 1655 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
484 | 484 | | |
485 | 485 | | |
486 | 486 | | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
487 | 530 | | |
488 | 531 | | |
489 | 532 | | |
| |||
0 commit comments