XtErrorMsg(3)

πŸ’– XtErrorMsg(3) β€” XT COMPATIBILITY FUNCTIONS πŸ’–

okay bestie, we're in the X Toolkit Intrinsics manual, section 3, and today's topic is high-level error handlers ✨ the little squad of functions that goes by the name XtErrorMsg, XtSetErrorMsgHandler, XtWarningMsg, and XtSetWarningMsgHandler. yes that's four whole names in one NAME line, they're a package deal, we don't split them up 🫢


✨ NAME ✨

XtErrorMsg, XtSetErrorMsgHandler, XtWarningMsg, XtSetWarningMsgHandler β€” high-level error handlers πŸ’…


🌸 SYNTAX 🌸

first things first, you gotta pull in the header or none of this exists:

#include <X11/Intrinsic.h>

then the four icons themselves:

_X_NORETURN void XtErrorMsg(const char *name, const char *type, const
       char *class, const char *defaultMsg, String *params, Cardinal
       *num_params);

void XtSetErrorMsgHandler(_X_NORETURN XtErrorMsgHandler msg_handler);

void XtSetWarningMsgHandler(XtErrorMsgHandler msg_handler);

void XtWarningMsg(const char *name, const char *type, const char *class,
       const char *defaultMsg, String *params, Cardinal *num_params);
not me pointing out that _X_NORETURN on XtErrorMsg and on the XtErrorMsgHandler in XtSetErrorMsgHandler β€” that's the compiler being told "this thing does NOT come back." it's giving final girl energy πŸ’€

πŸŽ€ ARGUMENTS πŸŽ€

  • class β€” the resource class of the error message. yes, it has a class, it's fancy like that πŸ‘‘
  • default β€” the default message to use. the fallback fit, the backup outfit πŸ’–
  • name β€” the general kind of error. the vibe category, if you will ✨
  • type β€” the detailed name of the error. like name but with receipts πŸ”
  • msg_handler β€” the new fatal error procedure, which should not return, or the nonfatal error procedure, which usually returns. literally the whole personality of the handler in one arg 😭
  • num_params β€” the number of values in the parameter list. count 'em πŸ”’
  • params β€” a pointer to a list of values to be stored in the message. the little payload that gets tucked into the message 🎁

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea, and it's a whole superseded situation, no cap:

  • The XtErrorMsg function has been superseded by XtAppErrorMsg. πŸ‘‹
  • The XtSetErrorMsgHandler function has been superseded by XtAppSetErrorMsgHandler. πŸ‘‹
  • The XtSetWarningMsgHandler function has been superseded by XtAppSetWarningMsgHandler. πŸ‘‹
  • The XtWarningMsg function has been superseded by XtAppWarningMsg. πŸ‘‹
fr fr, all four of these got replaced. they're the older generation of the family β€” still here, still valid, but the XtApp* versions are the main characters now. if you're writing new code, lowkey go say hi to the XtApp crew instead πŸ’…

🌈 SEE ALSO 🌈

go read these too, bestie, they're all connected:

  • XtAppErrorMsg(3)
  • X Toolkit Intrinsics - C Language Interface
  • Xlib - C Language X Interface

and that's the whole page, periodt ✨ this was X Version 11, libXt 1.3.1, and we've been living in XtErrorMsg(3) the entire time πŸ¦‹πŸ’– go forth and handle your errors, you absolute icon πŸ«ΆπŸŽ€

πŸ“¦ where this page comes from