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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:57:38+00:00 2026-05-31T20:57:38+00:00

What have people used to catch, log, and report multiple data validation errors at

  • 0

What have people used to catch, log, and report multiple data validation errors at once in Python?

I’m building an application in Python 3 that first validates input data and then processes it. Reporting errors in the first step is part of the intended functionality of the program, so I don’t want my validator to give up on the first exception. In particular, the data are tabular and I want be able to return — rather than raise — an exception for each line of the table that does not validate.

A forum discussion from a couple of years ago contemplates multiple solutions, including the following, which seems the cleanest to me:

errors = []
for item in data:
    try:
        process(item)
    except ValidationError as e:
        errors.append(e)
if errors:
    raise MultipleValidationErrors(errors)

where the MultipleValidationErrors class would have an appropriate __str__ method to list useful information about all the ValidationErrors in it.

Others recommend using the traceback module, but since the exceptions I want to catch are data validation errors rather than program errors, that seems inappropriate. Getting the logging module involved might be appropriate, though.

  • 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-31T20:57:39+00:00Added an answer on May 31, 2026 at 8:57 pm

    I’ve used this idiom in both C++ and Python. It’s the cleanest solution that I know of when what you want is an exception, rather than a log message. The downside to it is that the combined exception takes up linear space in general, which can be problematic when processing large datasets with many errors.

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

Sidebar

Related Questions

I have used several different scripts that people have suggested for trying to parse
I have an application used by pretty tech-savey people and they want small island
From Google Analytics I have a (long) list of keywords that people used in
What do people recommend for creating popup's in ASP.Net MVC? I have used the
Have people noticed that if you modify the source of a shell script, any
I have people, companies, employees, events and event kinds. I'm making a report/followup sheet
I was wondering how/if people have worked around db schema changes that would otherwise
I have used try-catch/except-finally variants in many languages for years, today someone asked me
Like plenty of other people before me, I have some web content that I
What ways have people found/used to add functionality to a .NET/C# app without recompiling?

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.