We have a C#/ASP.NET (2.0) application running on IIS 6 on Windows Server 2003 Enterprise Edition. This application reads Excel files using OleDb, but there are instances when we get an "Unspecified Error" exception thrown from within the application.
The file is stored in the temporary directory by our file upload code before opening...
I'm working on a project and I'm just starting to do all the work necessary to globalize the application. One thing that comes up quite often is whether to globalize the exception messages, but ensuring that string.Format uses CultureInfo.CurrentCulture instead of CultureInfo.InvariantCulture. Additionally this would mean that exception ...
Since I can't use Microsoft as an example for best practice since their exception messages are stored in resource files out of necessity, I am forced to ask where should exception messages be stored.
I figure it's probably one of common locations I thought of
Default resource file
Local constant
Class constant
Global exception message...
System.Configuration.ConfigurationErrorsException: Attempting to load this property's type resulted in the following error: Could not load type 'System.String'. (D:\Inetpub\wwwroot\driverseat\web.config line 223)
---> System.Web.HttpException: Could not load type 'System.String'.
at System.Web.Compilation.BuildManager.GetType(String typ...
The below is an involved problem, I've done a great amount of research, but have been unable to solve it thus far. I'm happy to find either a solution or a workaround. Although the framework is old (1.0) I am not at this stage able to upgrade to 1.1 or later (the client isn't willing to pay for the conversion at present), and I'm not eve...
I wrote an application that loops through a set of records and prints two things.
One is a report from SSRS wich works correctly.
The other is a drawing that uses a COM object to print. The COM object randomly fails and causes the program to quit.
Is there a way to stop it from killing the entire program when the COM Object fails? ...
I'm using reflection to add some data to a private variable inside a class from a third-party library. Along the way there are about four different Exceptions that can be thrown; all of them are related to reflection, and all of them are very unlikely to occur. I'm hardcoding the name of the class and variable involved. I'm unlikely t...
Do I need to create my own InvalidArgumentException.. I couldn't find any built-in types in c#... Is there any library which defines commonly used Exception classes.. Thanks
...
Is there an elegant way to handle exceptions that are thrown in the a finally block?
For example:
try {
// Use the resource.
}
catch( Exception ex ) {
// Problem with the resource.
}
finally {
try{
resource.close();
}
catch( Exception ex ) {
// Could not close the resource?
}
}
How do you avoid the try/catc...
I have several web services in the same package that throw a custom exception. The problem is that the generated exception class contains a reference to the web service that generated it, so I can't use the same exception name across multiple web services. Is there a way to make Axis2 generate the exception classes inside the web servi...
I am writing a few test cases that depend on the database being available, so on the @Before and @After I open and close the session (Hibernate), as well as start and finish the transaction.
Now in the process of development sometimes I get exceptions in the test cases, so the @After is never called and I can't clean up (or rollback the...
I have this factory method in java:
public static Properties getConfigFactory() throws ClassNotFoundException, IOException {
if (config == null) {
InputStream in = Class.forName(PACKAGE_NAME).getResourceAsStream(CONFIG_PROP);
config = new Properties();
config.load(in);
}
return config;
}
And I want ...
Hello all,
I am trying to serialize an Exception object in C#. However, it appears that it is impossible since the Exception class is not marked as Serializable. Is there a way to work around that?
UPDATE: If something goes wrong during the execution of the application, I want to be informed with the exception that occurred. My first r...
Hi Friends,
Ours is a J2EE app, using Struts-EJB-Hibernate on Websphere 6.1 over Mainframe/DB2 backend, that was recently moved to production.
We are getting stale connection exception when the user login to the application first time or some times this exception occurs intermittently.
on the second try the user able to log in to th...
I am intrigued by how the C++ exception handling mechanism works. Specifically, where is the exception object stored and how does it propagate through several scopes until it is caught? Is it stored in some global area?
Since this could be compiler specific could somebody explain this in the context of the g++ compiler suite?
...
Given: Throwable is Exception's superclass.
When I read tests on writing your own 'exceptions', I see examples of Throwable being used in the catch block and other text's show new Exception() being used in the catch block. I have yet to see an explanation of when one should use each.
My question is this, When should Throwable be used an...
/* user-defined exception class derived from a standard class for exceptions*/
class MyProblem : public std::exception {
public:
...
MyProblem(...) { //special constructor
}
virtual const char* what() const throw() {
//what() function
...
}
};
...
void f() {
...
//create an exception object and throw ...
When should I create a checked exception, and when should I make a runtime exception?
For example, suppose I created the following class:
public class Account {
private float balance;
/* ... constructor, getter, and other fields and methods */
public void transferTo(Account other, float amount) {
if (amount > bala...
Been doing Java for number of years so haven't been tracking C++. Has finally clause been added to C++ exception handling in the language definition?
Is there a favored idiom that mimics Java's try/finally?
Am also bothered that C++ doesn't have an ultimate super type for all possible exceptions that could be thrown - like Java's Throw...
According to the Java Language Sepecification, 3rd edition:
It is a compile-time error if a generic class is a direct or indirect subclass of Throwable.
I wish to understand why this decision has been made. What's wrong with generic exceptions?
(As far as I know, generics are simply compile-time syntactic sugar, and they will be t...