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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:26:12+00:00 2026-05-18T02:26:12+00:00

There is a list standard python exceptions that we should watch out, but I

  • 0

There is a list standard python exceptions that we should watch out, but I don’t think these are the ones we should raise ourselves, cause they are rarely applicable.

I’m curious if there exists a list within standard python library, with exceptions similar to .NET’s ApplicationException, ArgumentNullException, ArgumentOutOfRangeException, InvalidOperationException — exceptions that we can raise ourselves?

Or is there different, more pythonic way to handle common error cases, than raising standard exceptions?

EDIT: I’m not asking on how to handle exceptions but what types I can and should raise where needed.

  • 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-18T02:26:12+00:00Added an answer on May 18, 2026 at 2:26 am

    If the error matches the description of one of the standard python exception classes, then by all means throw it.

    Common ones to use are TypeError and ValueError, the list you linked to already is the standard list.

    If you want to have application specific ones, then subclassing Exception or one of it’s descendants is the way to go.

    To reference the examples you gave from .NET
    ApplicationException is closest to RuntimeError
    ArgumentNullException will probably be an AttributeError (try and call the method you want, let python raise the exception a la duck typing)
    AttributeOutOfRange is just a more specific ValueError
    InvalidOperationException could be any number of roughly equivalent exceptions form the python standard lib.

    Basically, pick one that reflects whatever error it is you’re raising based on the descriptions from the http://docs.python.org/library/exceptions.html page.

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

Sidebar

Related Questions

Is there any standard that has a list of web-safe fonts? I expected W3C
I implemented a custom list view, but now there's no visual feedback that an
Is there a list of 3D cards available that provide full scene antialiasing as
Is there any way to list all the files that have changed between two
EDIT: My question was originally Is there a standard name for a function that
Is there a pythonic way to build up a list that contains a running
We have a SharePoint solution that uses a standard task list. We would like
Is there any list of blog engines, written in Django?
Is there a list somewhere on common Attributes which are used in objects like
Is there a list describing all of the data_type parameters you can use in

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.