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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:53:15+00:00 2026-05-25T18:53:15+00:00

The project I’m working on has a lot of telemetry and debugging mechanisms built

  • 0

The project I’m working on has a lot of telemetry and debugging mechanisms built in that must be available in release, but MUST NOT be used by most parts of the system. I’d like to build a macro, to be called at the top of such methods, that would throw an exception if the method had not been called from one of a very limited group of modules.

For example, I have a debug module that I can use to manipulate system state from the console, and I have a web tool that allows admins to inspect and change the system. Some of the methods that are designed for their consumption (but are implemented in modules all over the system) are fine for occasional use, but would be crippling if someone made the mistake of calling them as part of normal operation.

EDIT: I’ve tried the lists:keysearch suggestion, below, and it works for any module that I can explicitly name, which is probably the best I’m ever going to manage. I have modules like web_foo, web_bar, web_foo_other, web_yippie_ki_yea_mf to match that I’m falling back on regexps for.

I can do something like the following. (I’ve not compiled this. I’m hoping that any answers you give will prevent me from ever putting this into production. =] )

try
  %gotta do this to get the stacktrace:
  throw(a)
catch
  _ -> 
    Stack = erlang:get_stacktrace(),
    {_, RegExp} = re:compile("webmanager", [multiline]),
    case Match = re:run(Stack, RegExp) of
      nomatch ->
        throw(im_sorry_dave__im_afraid_i_cant_do_that);
      {match, _} ->
        ok
    end
end
  • 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-25T18:53:16+00:00Added an answer on May 25, 2026 at 6:53 pm

    Since Stack is a list of tuples representing the method calls, you can use lists:keysearch(webmanager, 1, Stack) to check if the module is in the stack trace.

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

Sidebar

Related Questions

The project that I am working on (Node.js) implies lots of operations with the
The project currently has a UIviewController called Dashboard that acts as the main view
Project#1 has some interfaces and classes that project#2 references. Now I want to use
My project has no errors, I'm able to run it via F5, but I
My project consists of an app that links to two static libraries. Each of
This project was coped almost exacatly from the example on the admob page but
My project have no visible error but when i try to run it gives
Project Requirements: I need to build a web service that will receive chunks of
Project I'm working on uses jQuery. I have a series of Ajax calls being
Project being built on ASP.net v 2 VB.net IIS 6 SQL Server 2005 database

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.