diff --git a/src/rp2/tax_engine.py b/src/rp2/tax_engine.py index 4db7bd02..b9d74d10 100644 --- a/src/rp2/tax_engine.py +++ b/src/rp2/tax_engine.py @@ -194,7 +194,12 @@ def _create_unfiltered_gain_and_loss_set( ) except AcquiredLotsExhaustedException: - raise RP2ValueError("Total in-transaction crypto value < total taxable crypto value") from None + raise RP2ValueError( + f"Taxable out-transaction crypto value > acquired in-transaction crypto value by " + f"{acquired_lot_amount - taxable_event_amount} for {taxable_event}\n" + f"For more information, see Some Section in the User FAQ: " + f"https://github.com/eprbell/rp2/blob/main/docs/user_faq.md#somenewsection" + ) from None except TaxableEventsExhaustedException: pass diff --git a/tests/test_tax_engine.py b/tests/test_tax_engine.py index 92c91b61..120f163d 100644 --- a/tests/test_tax_engine.py +++ b/tests/test_tax_engine.py @@ -130,12 +130,30 @@ def test_bad_input(self) -> None: ) ) - with self.assertRaisesRegex(RP2ValueError, "Total in-transaction crypto value < total taxable crypto value"): + with self.assertRaises(RP2ValueError) as value_error: compute_tax( self._good_input_configuration, self._accounting_engine, input_data, ) + self.assertEqual( + str(value_error.exception), + """Taxable out-transaction crypto value > acquired in-transaction crypto value by -16.22000000000 for OutTransaction: + id=38 + timestamp=2020-06-01 03:59:59.000000 -0400 + asset=B4 + exchange=Coinbase Pro + holder=Bob + transaction_type=TransactionType.SELL + spot_price=900.9000 + crypto_out_no_fee=20.20000000 + crypto_fee=1.00000000 + unique_id= + is_taxable=True + fiat_taxable_amount=18198.1800 +For more information, see Some Section in the User FAQ: \ +https://github.com/eprbell/rp2/blob/main/docs/user_faq.md#somenewsection""", + ) if __name__ == "__main__":