You have an extra comma after both 'throw' instructions, which makes the compiler believe you want to throw nothing.
In addition, I would recommend that you actually catch the exceptions you throw by adding a try {...} catch (const char* str) {...} block around your code.