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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:23:57+00:00 2026-05-28T17:23:57+00:00

The Tcl error command writes the specified message to stderr adding to it a

  • 0

The Tcl error command writes the specified message to stderr adding to it a prefix “Error: “.

Is it possible to change that prefix with something else like “ERROR: ” or “MyError: ” ?

  • 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-28T17:23:58+00:00Added an answer on May 28, 2026 at 5:23 pm

    The error command itself does not write anything to anywhere other than the Tcl result. What it actually does is throw an exception (of type “error”; TCL_ERROR at the C API level). The code that prefixes it with “Error: ” is just the standard fallback handler, but you can use your own by having your main script use catch to trap any result and decide what to do with it (or try … from 8.6 onwards, which is easier to use when trapping specific problems).

    if {[catch {source realscript.tcl} msg]} {
        # Caught an error!
        puts stderr "Oh noes! Teh errorz iz atakkin! $msg"
        puts stderr $::errorInfo
        exit 1
    }
    

    OK, if you’re using 8.5 then a slightly better way to write that is:

    if {[catch {source realscript.tcl} msg resultdict]} {
        # Caught an error!
        puts stderr "Oh noes! Teh errorz iz atakkin! $msg"
        puts stderr [dict get $resultdict -errorinfo]
        exit 1
    }
    

    There’s lots of other interesting stuff in the result dictionary, which you might or might not be interested in. Have a poke around.

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

Sidebar

Related Questions

Is is possible to specify user defined command on error in tcl script? I
Working with TCL and I'd like to implement something like the Strategy Pattern .
I have a Tcl/Tk app that generates many forms and would like to be
Currently I have some code that is doing an SFTP via expect/tcl. Its something
I have a main TCL proc that sources tons of other tcl procs in
I'm looking to reimplement some Tcl code that uses the socket -server construct [1].
tclsh is a shell containing the TCL commands. The TCL uplevel command evaluates the
I'm currently wrapping a command line tool ( espeak ) with Tcl/Tk, and I
I am executing the following command in Makefile:- @ls export_mojave/marker_*.tcl > export_mojave.list @for file
In my TCL script I use rsync command and unfortunately it is refusing to

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.