I have some code in a Python except clause that is intended to do some logging, but the logging code might itself cause an exception. In my case, I'd like to just ignore any second exception that might occur, and raise the original exception. Here is a very simplified example:
try:
a = this_variable_doesnt_exist
except:
try:
...
How should I log exceptions? I never tried logging in .NET before. Nor try to dump exceptions to a txt (or binary) file. I dont require a text file, just a way to view the logs with the file and line #.
-edit- using asp.net
...
I spawn a thread on Application_Start and would like to log exceptions. There is not Context/HttpContext/HttpContext.Current, so how might i get it to log?
ATM it does not catch any exception in my threads and if i write ErrorSignal.FromCurrentContext().Raise(ex); i get an error about context cannot be null.
Maybe i can create a dummy ...
hi,
I am using asp.net memebrlogin_control and getting exception "The parameter 'username' must not contain commas. Parameter name: username". I am using emailID as username in this
How can i remove this error , and i would also like to know that what is the list of characters that should be disallowed to validate email address.
Thanks...
In our solution we have a project that contains all the exceptions.
All of the exceptions inherit our base exception which inherits from ApplicationException.
Our base exception includes a field for exception number.
What I would like to do is to run a script that creates a list with exception name, number and xml documentation.
Any ...
I'm getting a strange error on my webserver for seemingly every file but the .aspx files.
Here is an example. Just replace '/robots.txt' with any .jpg name or .gif or whatever and you'll get the idea:
The controller for path '/robots.txt'
was not found or does not implement
IController.
I'm sure it's something to do with how I...
When xml schema validation fails .Net throws some exception. Based on parsing this exception I know how to do some stuff. The problem is that this exception is localized, e.g. on a Japanese machine it is in Japanese.
I do not want to build my application so it will parse every error in any language.
I am an add-in to some other system...
Option 1:
def f1(c):
d = {
"USA": "N.Y.",
"China": "Shanghai"
}
if c in d:
return d[c]
return "N/A"
Option 2:
def f2(c):
d = {
"USA": "N.Y.",
"China": "Shanghai"
}
try:
return d[c]
except:
return "N/A"
So that I can then call:
for c in ("China", "Japan"):
for f in (f1, f2):
prin...
I have this procedure:
create or replace PROCEDURE CONVERTE
IS
CURSOR oldemployees IS
SELECT *
FROM emp1
WHERE data_saida= NULL;
new_ndep emp1.num_dep%type;
bi_inexistente EXCEPTION;
dep_inexistente EXCEPTION;
employeeNr emp1.num_empregado%type;
BEGIN
FOR old_emp IN oldemployees
LOO...
I've got a rake task on a rails app that needs one parameter, called USER_ID.
I think I'd like to throw an exception that halts the execution. This is what my task looks like:
desc "My rake task"
task :my_task => :envionment do
user_id = ENV["USER_ID"] or # THROW SOMETHING HERE
# ... do stuff with user_id
end
What code goes on...
Hi*,
I have been doing some work with python-couchdb and desktopcouch. In one of the patches I submitted I wrapped the db.update function from couchdb. For anyone that is not familiar with python-couchdb the function is the following:
def update(self, documents, **options):
"""Perform a bulk update or insertion of the given documen...
We've created a custom theme for a WPF application. The styles in this theme use various bindings. On startup of the application a lot of Exceptions like this occur:
System.ArgumentException occurred,
Message="The requested value \"RecordFixToBottomPrompt\" could not be found.", Source="mscorlib", at StackTrace: bei System.Enum.Parse(Ty...
When would be the best use of this type of exception and is it handeled properly if caught in a catch like so?
catch(Exception e)
Or does it need to be caught explicitly?
catch(IllegalArgumentException e)
...
I'm getting an:
System.Runtime.Serialization.SerializationException: Unable to find assembly 'myNameSpace, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
When trying to deserialize some data in another program than the program I serialized it with.
After some googling I've found out that apparently this can only be done using ...
I've built a WPF Control which displays an Image. Now I would like to change that image at a very fast rate.
I've build an ImageContainer class which holds the image and has a ChangedEventHandler which updates the Image in my control when changed.
The code which is executed looks like this:
videoImageThread = new Thread(
ne...
Hi,
I currently have a compiled C# program but whenever I run it I get the Windows encountered a problem error.
This is from a System.UnauthorizedAccess error, how can I give access and remove this error without any need from the user side, since this program is being deployed to a lot of people and I don't want them having to make thi...
Hello,
I've a table Role associated in 1-many relation with table User in my database. I've created LINQ mapping classes manually:
[Table(Name="Role")]
public class Role
{
private EntitySet<User> _Users;
[Column(IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.OnInsert)]
public int RoleID { get; set; }
[C...
Given this stack trace snippet
Caused by: java.net.SocketException:
Software caused connection abort:
socket write error at
java.net.SocketOutputStream.socketWrite0(Native
Method)
I tried to answer the following questions:
What code is throwing this exception? (JVM?/Tomcat?/My code?)
What causes this exception to be thro...
Hi all,
I've read and re-read Java Concurrency in Practice, I've read several threads here on the subject, I've read the IBM article Dealing with InterruptedException and yet there's something I'm simply not grasping which I think can be breaked down in two questions:
If I'm never ever interrupting other threads myself, what can trigg...
I have a PyObjC project that I build on Mac OS X 10.6 with XCode 3.2 and I'm not able to run on 10.5.
All I'm using is the official PyObjC project templates to create an empty project (that simply opens a window). Then I build the app and copy it over to 10.5. But the app always crashes on 10.5:
Application Specific Information:
*** Te...