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

  • Home
  • SEARCH
  • 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 5934429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:06:46+00:00 2026-05-22T15:06:46+00:00

I have these files in my project: – main.py – module1.py – module2.py main

  • 0

I have these files in my project:

- main.py
- module1.py
- module2.py

main is the main file that will be directly execute in console.

module1 will be imported into main and throws Module1Exception.

module2 will be imported into module1, throws Module2Exception
and uses lib that throws NormalException and CriticalException exceptions.

On all exceptions application should exit.

Which option is a most effective way to catch those errors?
a) All exceptions will be catch in main, print message and exit
b) Lets allow modules to catch exceptions (module2 catch lib exceptions, module1 catch only Module2Exception and main catch Module1Exception), print message and exit.
c) Like b, except that modules will not exit, instead returns False and exit will be called in main

Edit:

This will be server side application, running as daemon. I expect that in future I will be using multiple servers with global log monitoring, like flume or scribe. Exceptions must be caught. These files is only example. In fact, I’m writing a large application which is act as a kind of server. In this moment i write module for load and parse configuration file. In this case script should exit if any exceptions will be raised. And only in this case. After loading the configuration files and pass the tests, the script will be left unattended.

  • 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-22T15:06:47+00:00Added an answer on May 22, 2026 at 3:06 pm

    main should have the responsibility to terminate, not the modules.

    What if you wanted to import those modules into another project and you didn’t want to terminate the application on an exception?

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

Sidebar

Related Questions

There is a data file and some image files that I have to download
OK, so I have a C++ project that compiles to a DLL file. I
I have got .aspx and .aspx.cs files along with a web.config file; from these
I have a folder with these files: alongfilename1.txt <--- created first alongfilename3.txt <--- created
I have a class split across two files. One of these is generated, the
I have a website where users can upload their files; these are stored on
I have a ListView containing file names. These file names need to be draggable
Is there any way to list all the files that have changed between two
I have a number of large data files that I included in projects attributed
In VS2008, I have a web-site project. When I use find in files and

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.