Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • John 79 posts 115 karma points
    Dec 09, 2011 @ 13:00
    John
    0

    How to get detailed exception information from Courier

    I have been working on a problem deploying a Courier package for the last few days.  It occurs when I click "install" to deploy a package onto our test servers.

    Unfortunately, the error I get is always the same:

     

    License error

     

     

    Hello, you are currently trying to run a part of Courier which is not included in your current Courier license.

    There can be multiple reasons for this, but the most common one, is that you are using a Courier Expres license instead of the full version. Using an express license, means that you cannot:

    • If using a trial, you can only transfer content to locations on your local machine
    • Use the dedication Courier section
    • Call the Courier API from your own code
    • Add your own providers or data resolvers

    You can resolve this, by puchasing a full license on umbraco.com

     

    It then proceeds to list our licence details.  We have done several deployments here before without a problem.  I know it's picking up the licence because if I remove it I get a message about being in trial mode.  And, obviously, because it gives me all the details!

    Pretty convinced it wasn't a licence error I've been digging around and finally managed to find a way to decompile the Courier.UI source.  I found this in CourierBasePage.cs:

    protected void Page_Error(object sender, EventArgs e)
    {
    HttpRuntime.Cache.Insert("CourierAppError", (object) this.Server.GetLastError());
    this.Response.Redirect(UIConfiguration.LicenseErrorPage);
    }

    In LicenceErroror.cs it then does this:

    object ex = HttpRuntime.Cache.Get("CourierAppError");
    if (ex == null)
    return;

    It then goes on to swap out the text for panels with "Application Error" instead of "License Error" (providing the exception is of a particular type).

    So it appears that it uses the "license error" page as a default if it doesn't know what actually happened, and uses the volatile ASP.Net cache to tell the error page what happened.

    But in my case I believe that "CourierAppError" is not persisting in the cache between the two page requests.

    Does anyone know if there's a way for me to extract the real error from this?  I was hoping I could maybe change the asp.net Cache provider, or add some event handling to the cache, or try to prevent it expiring so quickly, but I'm not too sure how or if I can do that.  (I think you can only change the provider for output caching)

    In this particular case there seems to be an error writing to the "__backup" directory as one time I did receive a proper error, but trying again it went back to licence error so I think that's a fluke.  I renamed my existing "__backup" directory to see if that would help and it recreated it but I then get a "License error" again and don't know whether this is the same problem or not.

    But at any rate I need to figure out how to get proper exceptions out of Courier.

    We are using Courier 2.1 due to problems with 2.5.  But I decompiled the 2.5 source and sadly this same technique is still being used.

    If anyone could help I'd be really grateful!

    John

  • John 79 posts 115 karma points
    Dec 09, 2011 @ 16:02
    John
    0

    We did find the culprit in this case.  We had manually deployed a couple of Razor scripts and they were readonly.  After a large number of attempts we got the real error message again and were able to track it down.

    But I would still appreciate any assistance with how to get a more sensible error out of Courier as we regularly have issues with it and having a mechanism to find out what's wrong would save us a lot of frustration and head-scratching.

    I hope in a future version it can be corrected - even just removing the error handling altogether would be a god-send.

  • Per Ploug 865 posts 3491 karma points MVP admin
    Dec 12, 2011 @ 09:05
    Per Ploug
    0

    Hi John

    thanks for going through all this to figure out why it was displaying licensing errors instead of the real error, will have a look at how we can improve this, it's most likely because we switched to a multi-threaded application so the frontend could not see the cached error.

    Anyways, you should be able to get more detailed logging if you add <debugMode>true</debugMode> to the /config/courier.config settings file this will write out errors to /app_data/courier/log.txt

    /Per

     

  • John 79 posts 115 karma points
    Dec 12, 2011 @ 09:29
    John
    0

    Hi Per,

    Thanks very much for the reply.  I did try out the debugmode setting, but the log.txt file didn't really have anything useful in it - a few things like:

    Debug
    ~/bin/App_Web_renderform.ascx.6c82cfdd.lofkkvra.dll 

    But no actual errors.

    Well, tell a lie - the first few times we tried there was an "object reference..." error which came from our code )I think Courier must have been constructing our usre control classes which weren't expecting to be run out of the main Umbraco context), and then it took a clear-down of ASP.Net Temporary Files to get it to pick up the change once we'd fixed it.  But sadly after that we were still getting "License error" and no errors in log.txt..

    I'm wondering if a simple way to improve it would be to move the check for "is exception a licence exception..." that's in the licence error page and put it into Page_Error and then just allow any other exceptions to be thrown in all their glorious yellow glory. I think those yellow screens in .net are underrated.  :)

    As a side-note it does look like there may be a problem if you have read-only files in the Umbraco site.  Not sure if it's creating the backup of the files or overwriting them (think it's the backup although that makes less sense to me).  It's easily resolved at our end (once we know what files are involved) but might be nice if Courier  could handle them on its own anyway. 

    Again, thanks very much for the quick reply.

    John 

  • John 79 posts 115 karma points
    Dec 12, 2011 @ 12:22
    John
    0

    Sorry, Per - slightly missed a small detail in your reply!  You say there's a log in " /app_data/courier/log.txt" but the only log I could find is in the root of the web site, which is the one I was referring to.  It does seem to come from Courier, though - is this the one you mean?

  • Per Ploug 865 posts 3491 karma points MVP admin
    Dec 12, 2011 @ 13:30
    Per Ploug
    0

    Oh, yeah, it depends on the version of Courier I guess, in 2.0.x it's in the root, but from 2.5 I think we moved it to /app_data/courier

Please Sign in or register to post replies

Write your reply to:

Draft