suppress warnings/errors

Recommended Posts

Hey Peeps,

is there are way to suppress warnings and errors, so they don't show up in the debuglog?

I have a resource that is producing a lot of errors, but those errors are not important and not fixable (map scripts).

But they are spamming my debuglog too much so actual problems might be missed.

Is there something like that?


Share this post

Link to post
Any error is fixable, what's the issue?

Well surely they are fixable, but its not my business.

As I said, its maps scripts that are loaded and executed, I cannot fix them all :P

Share this post

Link to post

Try cancelling onDebugMessage if specific conditions are met. (not sure if it'll work, just guessing)

edit: won't work.

Share this post

Link to post

The only thing you can do to effectively hide errors and warnings which originate from scripting errors is making your own debug view, hiding the default one and control which messages do you want to be output to the new debug view by using the onClientDebugMessage event.

However, if that warnings and errors are caused by explicit calls to the outputDebugString function, you can disable that function (providing that scripts don't call it in a hacky manner, or overload it with another name) by using addDebugHook:

local targetResource = getResourceFromName("resource-name") 
local function disableDebugOutput(sourceResource) 
    if sourceResource == targetResource then 
        -- Don't call the actual function if the call is from the resource we want to block 
        return "skip" 
    -- Otherwise, continue normally 
addDebugHook("preFunction", disableDebugOutput, { "outputDebugString" }) 

Keep in mind that addDebugHook and any other approaches to hide that warnings are not designed with performance and retail use in mind, so it is not a good practice to just hide the errors in the script. Fixing the errors which cause the debug spam is the thing that should be done instead.

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.