[Lift] Re: reporting snippet instantiation errors
OK, I reworked it a bit so that you not only get the exception, but you get a stack trace. I can't think of any sane reason that you would want a snippet constructor exception so I figured the trace would be useful for troubleshooting. It's checked in on the wip-dcb-mighdoll-snippet-createexcpt branch. Any objections before I merge it? Derek On Fri, Mar 6, 2009 at 10:47 AM, Derek Chen-Becker wrote: > I agree that it's an iffy pattern, but I also think that it's important to > make error messages as clear as possible. I'm testing the patch right now > (made a minor mod) and I'll push the branch to github in a little bit for > review. > > Derek > > On Fri, Mar 6, 2009 at 9:14 AM, Timothy Perrett > wrote: > >> >> 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 >> - Show quoted text - >> >> >> On 06/03/2009 16:04, "Lee Mighdoll" wrote: >> >> - Show quoted text - >> >> 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 >> 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 >> 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 liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: reporting snippet instantiation errors
Actually, I had forgotten that we generally don't accept patches from the mailing list in order to keep the IP of Lift clean. All of the committers have to sign release forms to make sure that we don't taint the codebase. In your case this was relatively minor and I've done the equivalent work on the codebase myself. In the future it would be preferable to ask for a feature and let us implement it to be absolutely sure that nothing gets tainted. We very much appreciate the contributions that people on the list make, but we really have to be careful to avoid any unpleasant situations. We should probably have this information outlined on the website somewhere. Thanks, Derek On Fri, Mar 6, 2009 at 3:23 PM, Lee Mighdoll wrote: > Thanks for both the suggestion and the patch review. > > For future reference on submitting patches -- is it best to email a patch > or is there some more savvy git trick? > > Lee > > > On Fri, Mar 6, 2009 at 8:47 AM, Derek Chen-Becker > wrote: > >> I agree that it's an iffy pattern, but I also think that it's important to >> make error messages as clear as possible. I'm testing the patch right now >> (made a minor mod) and I'll push the branch to github in a little bit for >> review. >> >> Derek >> >> On Fri, Mar 6, 2009 at 9:14 AM, Timothy Perrett >> wrote: >> >>> >>> 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 >>> - Show quoted text - >>> >>> >>> On 06/03/2009 16:04, "Lee Mighdoll" wrote: >>> >>> - Show quoted text - >>> >>> 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 >>> 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 >>> 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 liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: reporting snippet instantiation errors
Thanks for both the suggestion and the patch review. For future reference on submitting patches -- is it best to email a patch or is there some more savvy git trick? Lee On Fri, Mar 6, 2009 at 8:47 AM, Derek Chen-Becker wrote: > I agree that it's an iffy pattern, but I also think that it's important to > make error messages as clear as possible. I'm testing the patch right now > (made a minor mod) and I'll push the branch to github in a little bit for > review. > > Derek > > On Fri, Mar 6, 2009 at 9:14 AM, Timothy Perrett > wrote: > >> >> 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 >> - Show quoted text - >> >> >> On 06/03/2009 16:04, "Lee Mighdoll" wrote: >> >> - Show quoted text - >> >> 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 >> 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 >> 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 liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: reporting snippet instantiation errors
Thanks for both the suggestion and the patch review. For future reference on submitting patches -- is it best to email a patch or is there some more savvy git trick? Lee On Fri, Mar 6, 2009 at 8:47 AM, Derek Chen-Becker wrote: > I agree that it's an iffy pattern, but I also think that it's important to > make error messages as clear as possible. I'm testing the patch right now > (made a minor mod) and I'll push the branch to github in a little bit for > review. > > Derek > > On Fri, Mar 6, 2009 at 9:14 AM, Timothy Perrett > wrote: > >> >> 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 >> - Show quoted text - >> >> >> On 06/03/2009 16:04, "Lee Mighdoll" wrote: >> >> - Show quoted text - >> >> 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 >> 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 >> 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 liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: reporting snippet instantiation errors
I agree that it's an iffy pattern, but I also think that it's important to make error messages as clear as possible. I'm testing the patch right now (made a minor mod) and I'll push the branch to github in a little bit for review. Derek On Fri, Mar 6, 2009 at 9:14 AM, Timothy Perrett wrote: > > 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- Show quoted text - > > > On 06/03/2009 16:04, "Lee Mighdoll" wrote: > > - Show quoted text - > > 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 > 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 > 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 liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: reporting snippet instantiation errors
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" 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 > 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 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 liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: reporting snippet instantiation errors
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 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 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 liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: reporting snippet instantiation errors
Sorry, to clarify, it was the snippet class constructor that threw, correct? On Fri, Mar 6, 2009 at 8:20 AM, Derek Chen-Becker 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- Show quoted text - > > > On Thu, Mar 5, 2009 at 10:59 PM, Lee Mighdoll 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 liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: reporting snippet instantiation errors
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 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 liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---