Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Worse than outsourcing...

Worse than outsourcing...

Scheduled Pinned Locked Moved The Lounge
helpannouncementjavascriptdatabasecom
29 Posts 15 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M martin_hughes

    Pete O'Hanlon wrote:

    Please don't make blanket generalisations about exception handling

    Exception handling is for girls.

    Currently Listening to: Shira Kammen, Music of Waters

    N Offline
    N Offline
    Nemanja Trifunovic
    wrote on last edited by
    #19

    martin_hughes wrote:

    Exception handling is for girls.

    And old ladies.

    Programming Blog utf8-cpp

    1 Reply Last reply
    0
    • A Adam Maras

      ToddHileHoffer wrote:

      I have an error handler I've been tweaking for years now. It uses reflection goodness and a whole lot more. If I get an exception it emails me the line number of the code that caused the problem the stack trace + all the session / viewstate / cookies / page info etc. If the error is a sql problem I get the sql text that caused it.

      Could I persuade you to share this with us? :-D

      T Offline
      T Offline
      ToddHileHoffer
      wrote on last edited by
      #20

      I didn't write all of this, it has been around for years. Also, I leave the debug set to true in the web.config. It is a performance hit, but that's not an issue in my environment. Our server is fast and we don't have that many users. using System; using System.Collections.Generic; using System.Text; using System.Net.Mail; using System.Web; using System.Collections.Specialized; using System.Configuration; using System.Collections; using System.Reflection; public class ErrorHandler { #region Declarations const String heading = @"

      "; const String td = @""; private HttpApplication application = null; private Exception exception = null; private string messageBody = string.Empty; private MailPriority mailPriority = MailPriority.Normal; private string subject = "Application Error"; private bool isWebApp = false; #endregion #region Configuration //********************************** // You must have the following in the web.config or ap.config // "autoDebugTo" // "autoDebugFrom" // "smtpHost" //********************************** private List toEmail { get { List objReturn = new List(); if (ConfigurationManager.AppSettings["autoDebugTo"].ToString().Contains(";")) { foreach (string x in ConfigurationManager.AppSettings["autoDebugTo"].ToString().Split(";".ToCharArray())) objReturn.Add(new MailAddress(x)); } else objReturn.Add(new MailAddress(ConfigurationManager.AppSettings["autoDebugTo"].ToString())); return objReturn; } } private MailAddress fromEmail { get { return new MailAddress(ConfigurationManager.AppSettings["autoDebugFrom"].ToString()); } } private string smtpHost { get { return ConfigurationManager.AppSettings["smtpHost"].ToString(); } } #endregion #region cTor public ErrorHandler(Exce

      N 1 Reply Last reply
      0
      • L l a u r e n

        are you sure you understand the web properly? :omg:

        "mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them"

        T Offline
        T Offline
        ToddHileHoffer
        wrote on last edited by
        #21

        Of course I understand it. It's just that I don't work for an IT company. Web Services don't play a role in most of the Intranet applications I work on.

        I didn't get any requirements for the signature

        L 1 Reply Last reply
        0
        • T ToddHileHoffer

          Of course I understand it. It's just that I don't work for an IT company. Web Services don't play a role in most of the Intranet applications I work on.

          I didn't get any requirements for the signature

          L Offline
          L Offline
          l a u r e n
          wrote on last edited by
          #22

          so then would you say that making blanket statements about "the web" and what is and isn't a good idea for web programming might not be your forte? i mean given that you say you're not working in a "web" environment as such just curious as your advice is just plain misguided for the web at large :|

          "mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them"

          T 1 Reply Last reply
          0
          • M martin_hughes

            Pete O'Hanlon wrote:

            Please don't make blanket generalisations about exception handling

            Exception handling is for girls.

            Currently Listening to: Shira Kammen, Music of Waters

            L Offline
            L Offline
            l a u r e n
            wrote on last edited by
            #23

            god doesn't use

            try {
            ......
            } catch (e){
            ...
            }

            he uses

            try {
            .....
            } chuck (norris){
            ...
            }

            and it gets handled :rolleyes:

            "mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them"

            1 Reply Last reply
            0
            • L l a u r e n

              so then would you say that making blanket statements about "the web" and what is and isn't a good idea for web programming might not be your forte? i mean given that you say you're not working in a "web" environment as such just curious as your advice is just plain misguided for the web at large :|

              "mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them"

              T Offline
              T Offline
              ToddHileHoffer
              wrote on last edited by
              #24

              Why is using a global error handler misguided exactly? If you can trap and error, do something and continue on with your code then use a try catch block. But that's rare isn't it? Otherwise, you don't need a try catch block. Just use the global asax. What is wrong with that?

              I didn't get any requirements for the signature

              L 1 Reply Last reply
              0
              • T ToddHileHoffer

                Why is using a global error handler misguided exactly? If you can trap and error, do something and continue on with your code then use a try catch block. But that's rare isn't it? Otherwise, you don't need a try catch block. Just use the global asax. What is wrong with that?

                I didn't get any requirements for the signature

                L Offline
                L Offline
                l a u r e n
                wrote on last edited by
                #25

                well with exceptions you should try to handle them where they happen so you can *try* to do something meaningful or at least give a meaningful error message checking user input with client-side validation is absolutely essential in the web at large i was just making the point that you seem to be in a particular environment that isn't really "the web" as such but that your blanket sounding statements appear to be describing what you think web programming should be about no offence meant at all was just musing :)

                "mostly watching the human race is like watching dogs watch tv ... they see the pictures move but the meaning escapes them"

                1 Reply Last reply
                0
                • V VentsyV

                  I think you make it worst than it is. Just try to divide the work between the two of you so that you do not step over your toes all time. Maybe you do one set of pages, he does another set of pages, given that you agree on the fundamentals such as database schemas or whatever everything should work fine. Also it might help to determine who the lead developer is in case a decision needs to be taken on a topic you two disagree.

                  G Offline
                  G Offline
                  Gabriel P G
                  wrote on last edited by
                  #26

                  Don“t worry, in a couple of months he will be promoted, so be kind to your future boss! :laugh:

                  1 Reply Last reply
                  0
                  • T ToddHileHoffer

                    I have met a couple Russians who were actually good at programming... BTW, using try catch blocks in a web application is so pointless. Just use the global asax and call your error handler...

                    I didn't get any requirements for the signature

                    P Offline
                    P Offline
                    Pawel Krakowiak
                    wrote on last edited by
                    #27

                    ToddHileHoffer wrote:

                    I have met a couple Russians who were actually good at programming...

                    I'm not imposing anything. :) Nationality has nothing to do with it.

                    ToddHileHoffer wrote:

                    using try catch blocks in a web application is so pointless.

                    Not if you can actually handle the exception. It's no different than in desktop, console and server applications.

                    1 Reply Last reply
                    0
                    • V VentsyV

                      I think you make it worst than it is. Just try to divide the work between the two of you so that you do not step over your toes all time. Maybe you do one set of pages, he does another set of pages, given that you agree on the fundamentals such as database schemas or whatever everything should work fine. Also it might help to determine who the lead developer is in case a decision needs to be taken on a topic you two disagree.

                      P Offline
                      P Offline
                      Pawel Krakowiak
                      wrote on last edited by
                      #28

                      VentsyV wrote:

                      Just try to divide the work between the two of you so that you do not step over your toes all time. Maybe you do one set of pages, he does another set of pages

                      We try to do that, I had to let some of the steam to go off yesterday because he touched MY classes and introduced a catch all construct and a not thread safe call in it, so I felt like my class was raped. :P

                      1 Reply Last reply
                      0
                      • T ToddHileHoffer

                        I didn't write all of this, it has been around for years. Also, I leave the debug set to true in the web.config. It is a performance hit, but that's not an issue in my environment. Our server is fast and we don't have that many users. using System; using System.Collections.Generic; using System.Text; using System.Net.Mail; using System.Web; using System.Collections.Specialized; using System.Configuration; using System.Collections; using System.Reflection; public class ErrorHandler { #region Declarations const String heading = @"

                        "; const String td = @""; private HttpApplication application = null; private Exception exception = null; private string messageBody = string.Empty; private MailPriority mailPriority = MailPriority.Normal; private string subject = "Application Error"; private bool isWebApp = false; #endregion #region Configuration //********************************** // You must have the following in the web.config or ap.config // "autoDebugTo" // "autoDebugFrom" // "smtpHost" //********************************** private List toEmail { get { List objReturn = new List(); if (ConfigurationManager.AppSettings["autoDebugTo"].ToString().Contains(";")) { foreach (string x in ConfigurationManager.AppSettings["autoDebugTo"].ToString().Split(";".ToCharArray())) objReturn.Add(new MailAddress(x)); } else objReturn.Add(new MailAddress(ConfigurationManager.AppSettings["autoDebugTo"].ToString())); return objReturn; } } private MailAddress fromEmail { get { return new MailAddress(ConfigurationManager.AppSettings["autoDebugFrom"].ToString()); } } private string smtpHost { get { return ConfigurationManager.AppSettings["smtpHost"].ToString(); } } #endregion #region cTor public ErrorHandler(Exce

                        N Offline
                        N Offline
                        NimitySSJ
                        wrote on last edited by
                        #29

                        "private bool isWebApp = false;" (ToddHileHoffer) Thanks for clearing up whether or not your apps are *real* web apps. I'm sure Lauren found this very helpful. ;)

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups