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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:32:45+00:00 2026-05-27T16:32:45+00:00

I am trying to have my page call a method and, if it fails,

  • 0

I am trying to have my page call a method and, if it fails, display an error in my mbResult control. However, since my method is a void method, I am having a hard time throwing the exception. If I throw it from the method end it will not display in my error box.

I have the following code in my my page:

try
{
    Facade.AcceptChanges();
} 
catch(FarAlreadyExistsException) 
{
    mbResult.Message = new MessageInfo(FutureActivitiesAlreadyExistsMessage);
    return;
}

the accept changes method is this

public void AcceptChanges() 
{
    try
    {
        DataContext.SaveChanges();
    }
    catch (Exception) 
    {
        return;
    }
}
  • 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-05-27T16:32:46+00:00Added an answer on May 27, 2026 at 4:32 pm

    Remove the second try-catch to let the exception get caught in your first catch block:

    public void AcceptChanges() 
    {
        DataContext.SaveChanges();
    }
    

    EDIT: It seems you should also apply the following change:

    try
    {
        Facade.AcceptChanges();
    } 
    catch(Exception) // according to the documentation, this should be an OptimisticConcurrencyException
    {
        mbResult.Message = new MessageInfo(FutureActivitiesAlreadyExistsMessage);
        return;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I have been trying to make a ajax call to a JSP page.
I'm trying to have a page with a bunch of buttons, each of which
I have a page that I am trying to make a generic style of
I have a page with a form where I'm trying to prevent duplicate submission,
I have a page going here that uses jQuery: http://treethink.com/services What I am trying
I'm trying to have a site set up so when the page loads there
I have am trying to create a simple voting page. There are a few
I have been trying to set the scroll of my page to a certain
For while I have been trying to set the Page Scaling of Excel page
I am trying to place a Loading Animation onto my page but have never

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.