Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7806377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:30:55+00:00 2026-06-02T02:30:55+00:00

As you all probably noticed, errors from different programs you get nowadays always have

  • 0

As you all probably noticed, errors from different programs you get nowadays always have that error id number, that actually means what happend.

I was thinking maybe it’s a good idea to have a Dictionary<int,string>, when int is the error id, and the string is a description of what occurred.

For example:

ErrorID: 404
Description: Page not found

I’m asking this because I found a downside, and not sure if it is a big deal (maybe I just don’t know how it’s done).
As a programmer, once you catch an exception, how exactly would you associate it with the error id? (so you could eventually provide the user with the Description for why his operation could not work out).

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T02:30:57+00:00Added an answer on June 2, 2026 at 2:30 am

    You are trying to transpose the good old’error code pattern. This is a good practice when you are dealing with exception-less languages(C for example) or black-box/remote process (HTTP request).

    In .net, you can use exceptions which include an error message :

    throw new Exception("File not found");
    

    Or even create your own exceptions :

    class FileNotFoundException : Exception
    {
      public FileNotFoundException() : base("File not found") {}
    }
    

    Usage:

    throw new FileNotFoundException();
    

    So, the answer : it might be a good pattern to handle error codes for errors that don’t happen often. .NET dictionaries are fast, but there is an overhead. But your question is not that far from the i18n stuff.

    The real question is : do you prefer error codes or exceptions ?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have code that all over the place(probably 20-30 instances) does this: <widget>.setVisible((condition ==
I noticed that BeanUtils.copyProperties(dest, src) has a strange side effect. All null Integers (probably
I'm probably doing this all wrong. I have a text file full of data
I've been working all day and I somehow can't get this probably easy task
I've noticed that I can not use all unicode characters in my python source
In almost all larger Java projects I've been involved with I've noticed that the
I noticed something odd today. I have an application that writes/read data to a
I've noticed that when I add alpha parameter to a geom all text on
We currently have avi-files that contain MP3-streams. We noticed that our provider cannot ensure
We have in one of our applications a single eclipse project that contains all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.