1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Detect error in console [PeperSpigot 1.12+]

Discussion in 'Skript' started by sOxTw, Sep 26, 2018.

Thread Status:
Not open for further replies.
  1. sOxTw

    sOxTw Member

    Joined:
    Jan 27, 2017
    Messages:
    35
    Likes Received:
    2
    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?
     
  2. Scholler

    Scholler Active Member

    Joined:
    Aug 6, 2018
    Messages:
    130
    Likes Received:
    9
    ?? You can't... If the console doesn't detects the error, there's no error, you just write your code wrong.
     
  3. sOxTw

    sOxTw Member

    Joined:
    Jan 27, 2017
    Messages:
    35
    Likes Received:
    2
    No, what I need is to detect the error in another plugin's console.
     
  4. Scholler

    Scholler Active Member

    Joined:
    Aug 6, 2018
    Messages:
    130
    Likes Received:
    9
    ugh, i don't understand what you want..
     
  5. TDragon_

    TDragon_ Active Member

    Joined:
    Jul 19, 2018
    Messages:
    86
    Likes Received:
    1
    Place the error dude...
     
  6. sOxTw

    sOxTw Member

    Joined:
    Jan 27, 2017
    Messages:
    35
    Likes Received:
    2
    What I need is to detect, for example, the following error.
    Code (Skript):
    1. [Craft Scheduler Thread - 9/ERROR]: [FeatherBoard] java.lang.IllegalArgumentException: Team name 'MVdWFB50552' is already in use
    2.  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.
     
  7. TPGamesNL

    Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    107
    Medals:
    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 Like x 1
  8. sOxTw

    sOxTw Member

    Joined:
    Jan 27, 2017
    Messages:
    35
    Likes Received:
    2
    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.
    --- Double Post Merged, Sep 30, 2018, Original Post Date: Sep 27, 2018 ---
    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 (Skript):
    1. [Craft Scheduler Thread - 9/ERROR]: [FeatherBoard] java.lang.IllegalArgumentException: Team name 'MVdWFB50552' is already in use
    2.  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 Like x 1
  9. TPGamesNL

    Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    107
    Medals:
    Do you have a specific code which is causing the error?
     
  10. Scholler

    Scholler Active Member

    Joined:
    Aug 6, 2018
    Messages:
    130
    Likes Received:
    9
  11. TPGamesNL

    Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    107
    Medals:
    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.
    --- Double Post Merged, Sep 30, 2018, Original Post Date: Sep 30, 2018 ---
    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)
     
    • Agree Agree x 2
  12. sOxTw

    sOxTw Member

    Joined:
    Jan 27, 2017
    Messages:
    35
    Likes Received:
    2
    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 (Skript):
    1. if the log level is error:
     
  13. TPGamesNL

    Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    107
    Medals:
    The log level is the thing that is in front of every console message, like [warn] or
     
  14. sOxTw

    sOxTw Member

    Joined:
    Jan 27, 2017
    Messages:
    35
    Likes Received:
    2
    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?
     
  15. TPGamesNL

    Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    107
    Medals:
    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
     
  16. sOxTw

    sOxTw Member

    Joined:
    Jan 27, 2017
    Messages:
    35
    Likes Received:
    2
    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 (Skript):
    1. on log:
    2.     if the log level is info:
    3.         set {_message} to the logged message
    4.         if {_message} contains "[Skript]":
    5.             if {Error} is not set:
    6.                 set {Error} to 1
    7.                 send "" to console
    8.                 send "" to console
    9.                 send "Cantidad de errores: %{Error}%" to console
    10.                 send "" to console
    11.                 send "" to console
    12.                 stop
    13.             else:
    14.                 add 1 to {Error}
    15.                 send "" to console
    16.                 send "" to console
    17.                 send "Cantidad de errores: %{Error}%" to console
    18.                 send "" to console
    19.                 send "" to console
    20.                 stop
    ERROR:
    Code (Skript):
    1. [16:36:25 ERROR]: can't understand this condition: 'the log level is info' (Erro
    2. r.sk, line 2: if the log level is info:')
     
  17. TPGamesNL

    Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    107
    Medals:
    Can you try if "%the log level%" is "info" for me?
     
  18. sOxTw

    sOxTw Member

    Joined:
    Jan 27, 2017
    Messages:
    35
    Likes Received:
    2
    Keep giving error.
    Code (Skript):
    1. [17:50:31 ERROR]: Can't understand this expression: the log level (Error.sk, lin
    2. e 2: if "%the log level%" is "info":')
     
  19. TPGamesNL

    Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    107
    Medals:
    Try if log level is info
     
  20. sOxTw

    sOxTw Member

    Joined:
    Jan 27, 2017
    Messages:
    35
    Likes Received:
    2
    Try to detect when / re reload config is given.
    That is, if it is an INFO record.
     
Thread Status:
Not open for further replies.

Share This Page

Loading...