Lee, 

That seems like a pretty dangerous opertation. Wouldn¹t you do:

class MySnippet {
  val file: Box[Source] = tryo {
    Source.fromFile("mistypedFileName")
  }
}

In this way you could then use pattern matching and avoid NPE¹s

Cheers, Tim

On 06/03/2009 16:04, "Lee Mighdoll" <[email protected]> wrote:

> Sure, thanks for taking a look.  My snippet class had something like this:
> 
> import scala.io.Source
> 
> class MySnippet {
>   val file = Source.fromFile("mistypedFileName")
> }
> 
> (The patched version generates two error log messages in this case.  I
> couldn't figure out a small patch to make it just one message.)  
> 
> Lee
> 
> On Fri, Mar 6, 2009 at 7:20 AM, Derek Chen-Becker <[email protected]>
> wrote:
>> Let me create a branch for this and test it out. Also, could you tell me what
>> the error was with your snippet so I can compare current behavior with what
>> the patch provides?
>> 
>> Derek
>> 
>> 
>> On Thu, Mar 5, 2009 at 10:59 PM, Lee Mighdoll <[email protected]> wrote:
>>> When I had a bug which threw an exception instantiating my snippet, Lift
>>> logged a confusing error message: "ClassNotFound".  The class was found, it
>>> just didn't run correctly... 
>>> 
>>> Enclosed is a patch to show a more informative error message. 
>>> 
>>> Lee
>>> 
>>> 
>> 
>> 
>> 
> 
> 
> > 
> 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to