I have custom exceptions in my MySpace project that look like this:
class CustomFooError: def __init __ (self, msg = "something went wrong in Foo."): Self.msg = msg def __str __ (self): return repr (self.msg) At different points in my code, I will pick up such exceptions:
increase the customfuck error ("things are running badly") When the DJgo catches these errors, debug mode me DJ Go get a standard stack-trace page. But I do not ever see my error messages - "things are running badly" never appear in the Debug Errors page
It looks like they have the exception value on the error page should appear as. I went back through the Denggo source, which is enough to find that it is from value field to sys.exc_info () , which is continuously "[exception ] Has been documented as an affiliate to increase the value or the second argument, which is always a class instance if the exception type is a class object. "Unfortunately, I do not know what to do with this information.
So my question is: How do I write and raise my custom exceptions to get more useful data in places such as Digongo error?
< Div class = "post-text" itemprop = "text">
I will only use super and specify exception msg attribute :
class CustomFooError (exception): def __init __ (self, msg = none): if msg is none: Msg = 'something went wrong in Fu.' Super (customfuck error, itself) .__ init __ (msg) I have tested this from within just a Django environment and it is correctly sent to the exception constructor Displays or passes no default.
Comments
Post a Comment