Solved Detect error in console [PeperSpigot 1.12+]

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

sOxTw

Member
Jan 27, 2017
35
2
8
30
Hello, I am somewhat worried about an error that a Scoreboard is giving me on my server, and the important thing would be to detect the error in the console, how could I do it?
 
Hello, I am somewhat worried about an error that a Scoreboard is giving me on my server, and the important thing would be to detect the error in the console, how could I do it?
?? You can't... If the console doesn't detects the error, there's no error, you just write your code wrong.
 
What I need is to detect, for example, the following error.
code_language.skript:
[Craft Scheduler Thread - 9/ERROR]: [FeatherBoard] java.lang.IllegalArgumentException: Team name 'MVdWFB50552' is already in use
 at org.apache.commons.lang.Validate.isTrue(Validate.java:136)
When the console prints it, detect it in some way, be it with Skript or some Addon.
 
What I need is to detect, for example, the following error.
code_language.skript:
[Craft Scheduler Thread - 9/ERROR]: [FeatherBoard] java.lang.IllegalArgumentException: Team name 'MVdWFB50552' is already in use
 at org.apache.commons.lang.Validate.isTrue(Validate.java:136)
When the console prints it, detect it in some way, be it with Skript or some Addon.
Maybe FeatherBoard has an API for that, if they do, use skript-mirror, but if they don't then I have no idea how you should do that
 
  • Like
Reactions: sOxTw
Maybe FeatherBoard has an API for that, if they do, use skript-mirror, but if they don't then I have no idea how you should do that

Thank you very much I will try to do something with Skript-Mirror, if I do not understand I will ask for help. Really, thank you.
[doublepost=1538265651,1538076529][/doublepost]Hi again, I have managed to find a line to detect errors in consoles and perform actions but I do not understand how to use it. Someone to give me a hand?

Code that I need to detect:
code_language.skript:
[Craft Scheduler Thread - 9/ERROR]: [FeatherBoard] java.lang.IllegalArgumentException: Team name 'MVdWFB50552' is already in use
 at org.apache.commons.lang.Validate.isTrue(Validate.java:136)

Add-on: https://skript-mirror.gitbook.io/docs/advanced/error-handling#programmatic-access

From already thank you very much
 
  • Like
Reactions: TPGamesNL
Thank you very much I will try to do something with Skript-Mirror, if I do not understand I will ask for help. Really, thank you.
[doublepost=1538265651,1538076529][/doublepost]Hi again, I have managed to find a line to detect errors in consoles and perform actions but I do not understand how to use it. Someone to give me a hand?

Code that I need to detect:
code_language.skript:
[Craft Scheduler Thread - 9/ERROR]: [FeatherBoard] java.lang.IllegalArgumentException: Team name 'MVdWFB50552' is already in use
 at org.apache.commons.lang.Validate.isTrue(Validate.java:136)

Add-on: https://skript-mirror.gitbook.io/docs/advanced/error-handling#programmatic-access

From already thank you very much
Do you have a specific code which is causing the error?
 
I think there is no way to detect an error with Skript, but you can cause it ( https://skript-mirror.gitbook.io/docs/advanced/error-handling#programmatic-access )

Yeah, maybe if you have a specific code for that you can detect it. Not the error, the code which causes the error! Maybe this helps: https://www.spigotmc.org/threads/skript-get-info-from-a-script-to-another-one.253249/
There is a chance that FeatherBoard has an API for error handling stuff, and if they do, it can be possible to catch errors. And for the second part, it is possible with the link you send (under Error Object). Whenever you run the code which may cause an error, you check if that expression changed.
[doublepost=1538311556,1538291144][/doublepost]I just found another possible method for detecting console messages: https://github.com/Blueyescat/skript-logs. Take a look at it (it can receive every message logged to console)
 
I am reading the Skript-Log documentation and the truth is very confusing or I can not figure out how it works, how I detect errors, and I keep them in a variable to have a count of how many times I pass?

I found the following line but I do not understand its correct use.
code_language.skript:
if the log level is error:
 
The log level is the thing that is in front of every console message, like [warn] or
 
I do not need the entire code, but help me get started. How can I start to detect errors and save them in a variable, by the time I get to the number of times, the console executes a command?
 
I do not need the entire code, but help me get started. How can I start to detect errors and save them in a variable, by the time I get to the number of times, the console executes a command?
Use on log, see if it's from featherboard with logger name and check if it's the specific error with logged message. Then add 1 to a variable, if that variable is above a specific amount, set it to 0 and execute a command
 
mmmh I do not understand how to detect that this is the message I want to generate a variable. Because it can not be compared to a text.


CODE:
code_language.skript:
on log:
    if the log level is info:
        set {_message} to the logged message
        if {_message} contains "[Skript]":
            if {Error} is not set:
                set {Error} to 1
                send "" to console
                send "" to console
                send "Cantidad de errores: %{Error}%" to console
                send "" to console
                send "" to console
                stop
            else:
                add 1 to {Error}
                send "" to console
                send "" to console
                send "Cantidad de errores: %{Error}%" to console
                send "" to console
                send "" to console
                stop

ERROR:
code_language.skript:
[16:36:25 ERROR]: can't understand this condition: 'the log level is info' (Erro
r.sk, line 2: if the log level is info:')
 
mmmh I do not understand how to detect that this is the message I want to generate a variable. Because it can not be compared to a text.


CODE:
code_language.skript:
on log:
    if the log level is info:
        set {_message} to the logged message
        if {_message} contains "[Skript]":
            if {Error} is not set:
                set {Error} to 1
                send "" to console
                send "" to console
                send "Cantidad de errores: %{Error}%" to console
                send "" to console
                send "" to console
                stop
            else:
                add 1 to {Error}
                send "" to console
                send "" to console
                send "Cantidad de errores: %{Error}%" to console
                send "" to console
                send "" to console
                stop

ERROR:
code_language.skript:
[16:36:25 ERROR]: can't understand this condition: 'the log level is info' (Erro
r.sk, line 2: if the log level is info:')
Can you try if "%the log level%" is "info" for me?
 
Keep giving error.
code_language.skript:
[17:50:31 ERROR]: Can't understand this expression: the log level (Error.sk, lin
e 2: if "%the log level%" is "info":')
 
Keep giving error.
code_language.skript:
[17:50:31 ERROR]: Can't understand this expression: the log level (Error.sk, lin
e 2: if "%the log level%" is "info":')
Try if log level is info
 
Try to detect when / re reload config is given.
That is, if it is an INFO record.
 
Status
Not open for further replies.