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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:17:19+00:00 2026-06-11T10:17:19+00:00

I am writing a tool that processes some files. This tool will have a

  • 0

I am writing a tool that processes some files. This tool will have a command-line interface but can also be used as a class library from third-party code. To deal with an error, I just throw an exception. Third-party code can handle the exception, and the command-line interface might just print it and abort. However, apart from fatal errors, it is also possible that a situation arises that is not fatal and the process can continue, for which I would like to ‘throw a warning’ and continue.

How do I deal with warnings, in such way that both third-party code and the command-line interface can do something with it?

  • 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-11T10:17:20+00:00Added an answer on June 11, 2026 at 10:17 am

    You throw an exception for this as well (assuming the error condition is indeed exceptional – that is expected to be rare).

    Exceptions are not always lethal – you need to throw a specific type of exception that the third party code and command line code can catch and act on.

    One rule of exception handling is to handle exceptions you know how to handle – if you have a specific exception type for the error and you document it, client code should know how to deal with it (or not).


    If what you are trying to do is provide information to using code – warnings that are handled within your library already but that the users may want to know – you can output traces using the tracing subsystem. All users will need to do is configure a listener and will be able to get the information during runtime.

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

Sidebar

Related Questions

I'm writing a command-line tool for Mac OS X that processes a bunch of
I am writing a code generation tool that frequently will have lines like StringBuilder
I'm writing some sort of backup tool that has to copy all the files
I have been writing command-line Python scripts for a while, but recently I felt
I'm writing a small tool to do some manipulation of SWF files, using Delphi
I'm writing a program in C# that will compile java files using the java
I'm writing a tool that will generate HTML based on JSON data, and puts
I have a particular problem, I have some program that I cannot modify but
I found in IOStat, that some part of my application is writing extensively, but
Is there a tool that will show me what applications are writing to the

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.