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 7996421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:42:24+00:00 2026-06-04T14:42:24+00:00

I have a web-application: ExtJs frontend – EntityFramework + SQL Server as a backend.

  • 0

I have a web-application: ExtJs frontend – EntityFramework + SQL Server as a backend. Let’s take a look at one of the error scenarios:

  • I have database constrains for username (name must be unique)
  • I don’t have any client side validation for that (should I? is there way to make such validation generic?)
  • Server returns 500 error if I try to insert user with the same name.
  • If I run it from the same machine IIS is on – I get full error message (basically SQL exception description with key violation etc), if I run it from other machine – I just get 500 error and no error message.

What’s the best approach to handle this? I need to tell user in some human readable format about the error. I really don’t want to turn on error messaging on the IIS because it’s not a good practice.

  • 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-04T14:42:26+00:00Added an answer on June 4, 2026 at 2:42 pm

    I think you don’t have an error here, but a business rule violation.

    I like to differentiate both of them, being the first some unexpected situation (like a database conection loss) and the later some scenario that you know its likely to happen.

    For errors, I think the appropiate is to inform the user in a generic fashion (say, “an unexpected error has ocurred”) because its something that the user can’t correct nor need detailed information.

    On the other hand, a business rule is something that the user might understand and can take action to correct (here, the user name constraint). So it should be notified to the user.

    In projects I’ve worked on, we have a type of exception, BusinessException. We throw it with a message indicating what was the problem and it renders in a human readable format. We don’t explicity try-catch this exceptions, but use a handler to manage them. If you’re using MVC, there is an extension hook where you can do it.

    For other types of exceptions, its a good practice to log the stacktrace somewhere (i.e. EventViewer), but not give the user the details.

    In this case, I would do the following:

    • Have a button check names to allow the user pre-validate the name.
    • The place to validate the name, depends on where you want to have your application’s business logic. On the DB, using stored procedures, is an approach, but if you’re using EF, this means that you want to abstract from the data access. Instead, you can write this validation by yourself, using LINQ (something like Context.Users.SingleOrDefault(x => x.Name == name) and then check whether it returns null or some user. You might think this validation is not neccesary as you already have your DB constraint, but doing this way, the logic remains in your application’s code.
    • Capturing an exception from EF could be messy, because you need to check a SQL error code to determine whether it was a constraint violation or other error. And even if you determine that, you need to transform the message into a user friendly one.

    I hope this helps you in your decision!

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

Sidebar

Related Questions

I have web application running with a default impl of a backend service. One
I have web application written in java using Eclipse. It has just one servlet
I have web application Project having RPC call. one RPC async is working fine.
I have a web application in ExtJS and used the Gray Theme . Now
I have rich web application with a lot of dynamic stuff (used ExtJS 3.0).
I have web application that are using multiple clients. I should create one copy
I have set up an Apache server running locally that hosts my web application
I have web application which we deployed in a production . We have separate
I have web application and I do not really care about IE6 users. However
I have web application of which major part is javascript. I request images from

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.