Adding better assertion for exceptions