I tried to throw an InvalidArgumentException in a Silverlight 3 class library, and this type is not available. It doesn't even give me the red underline that tells me it's in a referenced assembly but I just need to import or fully qualify the namespace. Do I have to import a whole other assembly just to get this exception class, or do...
I want my application to never just crash stupidly. I know that code quality is the root solution for this. But I still need an application to never crash when some unexpected bug happens. Here is code I want to try.
-(void)testException
{
@try
{
NSString* str;
[str release];
}
@catch(NSException* ex)
...
I have a functional test suite failing in a Rails 2.2.2 application. The exception thrown, and the associated lines are below:
ActionView::TemplateError: Attempt to call private method
On line #55 of app/views/wine/view.html.erb
53: <% for activity in @activities %>
54:
55: <% if activity.context == 'ItemComment' ...
Hi,
I am using postgresql-8.3-603.jdbc4.jar with jdk 1.6 in my application to do the db operations. I am getting the below exceptions at sometimes and doing restart helps to avoid this exceptions temporarily.
org.postgresql.util.PSQLException: The column name sender_id was not found in this ResultSet.
at org.postgresql.jdbc2.A...
I am using system.timer in a windows service application (c#) and have added:
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.UnhandledException += new UnhandledExceptionEventHandler(MyExceptionHandler);
To handle my exceptions, does this work in a Windows Service as it does not seem to work?
Does nyone have any alter...
How can I make gdb interrupt (like in breakpoint) the program at the point where an exception is thrown, and interrupt again on rethrows and beginnings of the relevant catch blocks?
...
Hi,
We have repositories which have a "Save" method. They also throw a "Created" event whenever an entity is saved.
We have been trying to use Moq to mock out the repository as such....
var IRepository = new Mock<IRepository>();
Request request = new Request();
IRepository.Setup(a => a.Save(request)).Raises(a => a.Created += null, Req...
One of my [DataContract] classes contains a [DataMember] which is a List. BaseClass has a few different sub-classes.
Whenever that List contains instances of any sub-class, an exception occurs during/after the Service is returning to the request channel. If the List does not contain any sub-classes, it works fine.
Here is an example of...
Here is main():
int main()
{
B b(1,"two","three");
try
{
f1(b);
}
catch(B& b_ref)
{
cout<<"Caught B&"<<endl;
b_ref.print();
}
catch(A& a_ref)
{
cout<<"Caught A&"<<endl;
a_ref.print();
}
system("pause");
return 0;
}
Here is f1():
void f1(A& subjec...
I have a class with number of methods and want to have one exception handler for them all.
There are so many of these methods and they have different parameters, that it would be ugly to write try/catch for each of them.
Do you maybe know a way where I can do it with having a one in class exception handler, which will handle them all.
...
I'm using Moq for unit tests, and I've set up an expectation like this:
myMock.Expect(w => w.MyMethod(It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<string>(),
It.IsAny<System.Exception>(), null))
.Returns(myResult);
the method it is mock...
What is the best practice to follow when you need to throw an exception which was not defined in an interface that you are implementing?
Here is an example:
public interface Reader
{
public abstract void read() throws IOException;
}
public class CarrotReader implements Reader
{
public void read() throws IOException {}
}
publi...
As when using any other class or third party libraries, one would expect exceptions to be documented as well, so I've always found somewhat redundant to add text descriptions to them. Are they really necessary?
What are your thoughts? Thanks in advance.
...
Possible Duplicate:
When to choose checked and unchecked exceptions
Hello!
So, I'm still getting comfortable regarding when to throw a checked or unchecked exception. I would like to know what others think is the most appropriate in this case:
class Correlation<T>
{
private final T object1, object2;
private final doub...
I would like to log unhandled exceptions from the global.asax to the Application eventlog. However, I've noticed that IIS is already logging these unhandled exceptions as warnings. Is there a way to suppress these messages since I'm planning on logging them myself or do you think it’s reasonable to have both entries there (the event lo...
Hi,
I am developing an iPhone app using Core Data and ahev noticed that I get exceptions when I would expect and error, this is an example:
NSError *error;
// exception here if edited attribute name todoText in modeller and generated new database with that new name in it(ie clearing the iphone), ie tring to access a field not in the d...
This question is specific to using PHPUnit.
PHPUnit automatically converts php errors to exceptions. Is there a way to test the return value of a method that happens to trigger a php error (either built-in errors or user generated errors via *trigger_error*)?
Example of code to test:
function load_file ($file)
{
if (! file_exists(...
I am following along with the Summer of NHibernate Screencast Series and am running into a strange NHibernate Exception.
NHibernate.Hql.Ast.ANTLR.QuerySyntaxException:
Exception of type
'Antlr.Runtime.NoViableAltException' was thrown.
[select from DataTransfer.Person p where p.FirstName=:fn].
I have deviated from the Screencast Series...
In the application I am writing, the user has the ability to add some folder to search for some files recursively.
The problem is the files he wants to add to the app might be stored in the base drive like K:. So if he add this drive directly, I get an exception.
Or if he adds C:\, then I get UnauthorizedAccessException where it says:
...
In my LINQ-to-SQL DAL, I'm getting a "Specified Cast Was Not Valid."
Here is the exact error:
System.InvalidCastException was unhandled by user code Message="Specified cast is not valid." Source="System.Data.Linq" StackTrace:
at System.Data.Linq.IdentityManager.StandardIdentityManager.SingleKeyManager`2.TryCreateKeyFromValues(Ob...