Practice ยท 2 of 3
assertThrows
Write assertThrows(fn, errClass, msgPart) โ call fn(); if it does NOT throw, fail (return "no-throw"). If it throws the wrong error class, return "wrong-type". If errClass is given and msgPart is given, the error message must contain msgPart, else return "wrong-message". On full success return "ok".
Difficulty: intermediate
Press Submit to check your solution.
Back to lesson: Practice: Build Your Own Assertions โ Practice