Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialIgor Kletsov
7,556 PointsWhat wrong?
Challenge Task 2. Add a constructor to TooBigException that accepts a string for the exception message.
what is missing?
namespace Treehouse.CodeChallenges
{
class TooBigException: System.Exception
{
public TooBigException (string message)
{
}
}
}
8 Answers
Jeremy McLain
Treehouse Guest TeacherMy apologies. I'm just now taking a look at this. This wasn't a compiler error. C# has very few requirements regarding spaces. The problem was in our test code.
Also, Igor is missing the call to the base constructor, so his code will still fail the challenge, but with a better error now.
Jeremy Hill
29,567 PointsThis just passed the challenge:
namespace Treehouse.CodeChallenges
{
class TooBigException: System.Exception{
public TooBigException(string message)
: base(message)
{
}
}
}
Igor Kletsov
7,556 PointsYour code works, my no. what is the difference ?
namespace Treehouse.CodeChallenges
{
class TooBigException : System.Exception
{
public TooBigException (string message) : base (message)
{
}
}
}
Jeremy Hill
29,567 PointsDo you see that space between TooBigException and your parameters? Try deleting that space, I bet that will fix it.
Igor Kletsov
7,556 PointsThank you, you're right. I spent two hours on it. I hate those bugs.
Michele Morison
13,407 PointsThis worked for me!
namespace Treehouse.CodeChallenges { class TooBigException : System.Exception { public TooBigException() { } } }
Jeremy Hill
29,567 Pointspublic TooBigException(string message)
: base(message)
{
}
Igor Kletsov
7,556 PointsI tried, does not work
Jeremy Hill
29,567 PointsYou're welcome, yeah those compilers can be picky sometimes.
Quanhu LEE
665 Pointsnamespace Treehouse.CodeChallenges { class TooBigException: System.Exception //Exception is in System namespace { } }
HIDAYATULLAH ARGHANDABI
21,058 Pointsthe correct answer is
namespace Treehouse.CodeChallenges
{
class TooBigException : System.Exception
{
}
}
rakesh prasad
505 Pointsrakesh prasad
505 Pointsnamespace Treehouse.CodeChallenges { class TooBigException : System.Exception { public TooBigException() {
}