[{"data":1,"prerenderedAt":1134},["ShallowReactive",2],{"docs-navigation:\u002Fdocs\u002Fmodules\u002Fvital-commands\u002Fexception-handling":3,"docs-page-estimated-read-time:\u002Fdocs\u002Fmodules\u002Fvital-commands\u002Fexception-handling":399,"docs-page:\u002Fdocs\u002Fmodules\u002Fvital-commands\u002Fexception-handling":400},[4,9,41,69,282],{"title":5,"path":6,"stem":7,"icon":8},"Welcome to the Vital docs","\u002Fdocs\u002Fabout","docs\u002F1.about","i-lucide-info",{"title":10,"path":11,"stem":12,"children":13,"icon":40},"Getting started","\u002Fdocs\u002Fgetting-started","docs\u002F2.getting-started\u002F1.index",[14,16,35],{"title":15,"path":11,"stem":12,"icon":8},"What is Vital?",{"title":17,"icon":18,"path":19,"stem":20,"children":21,"page":34},"Installation","i-lucide-download","\u002Fdocs\u002Fgetting-started\u002Finstallation","docs\u002F2.getting-started\u002F1.installation",[22,26,30],{"title":23,"path":24,"stem":25},"Using a starter project (~5 minutes)","\u002Fdocs\u002Fgetting-started\u002Finstallation\u002Fstarter","docs\u002F2.getting-started\u002F1.installation\u002F2.starter",{"title":27,"path":28,"stem":29},"Manual configuration (~7-8 minutes)","\u002Fdocs\u002Fgetting-started\u002Finstallation\u002Fmanual","docs\u002F2.getting-started\u002F1.installation\u002F3.manual",{"title":31,"path":32,"stem":33},"Using the initializer (~2-3 minutes)","\u002Fdocs\u002Fgetting-started\u002Finstallation\u002Finitializer","docs\u002F2.getting-started\u002F1.installation\u002F4.initializer",false,{"title":36,"path":37,"stem":38,"icon":39},"Main class","\u002Fdocs\u002Fgetting-started\u002Fmain-plugin-class","docs\u002F2.getting-started\u002F2.main-plugin-class","i-lucide-play","i-lucide-circle-play",{"title":42,"path":43,"stem":44,"children":45,"icon":68},"Conventions","\u002Fdocs\u002Fconventions","docs\u002F3.conventions\u002F1.index",[46,48,52,56,60,64],{"title":47,"path":43,"stem":44,"icon":8},"About",{"title":49,"path":50,"stem":51},"Spring","\u002Fdocs\u002Fconventions\u002Fspring","docs\u002F3.conventions\u002F2.spring",{"title":53,"path":54,"stem":55},"Platforms","\u002Fdocs\u002Fconventions\u002Fplatform-implementations","docs\u002F3.conventions\u002F3.platform-implementations",{"title":57,"path":58,"stem":59},"Metadata","\u002Fdocs\u002Fconventions\u002Fmetadata","docs\u002F3.conventions\u002F4.metadata",{"title":61,"path":62,"stem":63},"Lifecycles","\u002Fdocs\u002Fconventions\u002Flifecycles","docs\u002F3.conventions\u002F5.lifecycles",{"title":65,"path":66,"stem":67},"(Optional) Advanced class loading","\u002Fdocs\u002Fconventions\u002Fadvanced-classloading","docs\u002F3.conventions\u002F6.advanced-classloading","i-lucide-cog",{"title":70,"path":71,"stem":72,"children":73,"icon":281},"Modules","\u002Fdocs\u002Fmodules","docs\u002F4.modules\u002F1.index",[74,76,100,106,112,126,136,150,164,178,188,224,234,248,257,275],{"title":75,"path":71,"stem":72,"icon":8},"What are modules?",{"title":77,"path":78,"stem":79,"children":80,"icon":99},"vital-core","\u002Fdocs\u002Fmodules\u002Fvital-core","docs\u002F4.modules\u002F2.vital-core\u002F1.index",[81,83,87,91,95],{"title":82,"path":78,"stem":79,"icon":8},"About this module",{"title":84,"path":85,"stem":86},"Configuration","\u002Fdocs\u002Fmodules\u002Fvital-core\u002Fconfiguration","docs\u002F4.modules\u002F2.vital-core\u002F2.configuration",{"title":88,"path":89,"stem":90},"Listeners","\u002Fdocs\u002Fmodules\u002Fvital-core\u002Flisteners","docs\u002F4.modules\u002F2.vital-core\u002F3.listeners",{"title":92,"path":93,"stem":94},"Conditional beans","\u002Fdocs\u002Fmodules\u002Fvital-core\u002Fconditional-beans","docs\u002F4.modules\u002F2.vital-core\u002F4.conditional-beans",{"title":96,"path":97,"stem":98},"Repositories","\u002Fdocs\u002Fmodules\u002Fvital-core\u002Frepositories","docs\u002F4.modules\u002F2.vital-core\u002F5.repositories","",{"title":101,"path":102,"stem":103,"children":104,"icon":99},"vital-cloudnet4-bridge","\u002Fdocs\u002Fmodules\u002Fvital-cloudnet4-bridge","docs\u002F4.modules\u002Fvital-cloudnet4-bridge\u002F1.index",[105],{"title":82,"path":102,"stem":103,"icon":8},{"title":107,"path":108,"stem":109,"children":110,"icon":99},"vital-cloudnet4-driver","\u002Fdocs\u002Fmodules\u002Fvital-cloudnet4-driver","docs\u002F4.modules\u002Fvital-cloudnet4-driver\u002F1.index",[111],{"title":82,"path":108,"stem":109,"icon":8},{"title":113,"path":114,"stem":115,"children":116,"icon":99},"vital-commands","\u002Fdocs\u002Fmodules\u002Fvital-commands","docs\u002F4.modules\u002Fvital-commands\u002F1.index",[117,118,122],{"title":82,"path":114,"stem":115,"icon":8},{"title":119,"path":120,"stem":121},"Commands","\u002Fdocs\u002Fmodules\u002Fvital-commands\u002Fcommands","docs\u002F4.modules\u002Fvital-commands\u002Fcommands",{"title":123,"path":124,"stem":125},"Exception handling","\u002Fdocs\u002Fmodules\u002Fvital-commands\u002Fexception-handling","docs\u002F4.modules\u002Fvital-commands\u002Fexception-handling",{"title":127,"path":128,"stem":129,"children":130,"icon":99},"vital-configs","\u002Fdocs\u002Fmodules\u002Fvital-configs","docs\u002F4.modules\u002Fvital-configs\u002F1.index",[131,132],{"title":82,"path":128,"stem":129,"icon":8},{"title":133,"path":134,"stem":135},"Configs","\u002Fdocs\u002Fmodules\u002Fvital-configs\u002Fconfigs","docs\u002F4.modules\u002Fvital-configs\u002F2.configs",{"title":137,"path":138,"stem":139,"children":140,"icon":99},"vital-holograms","\u002Fdocs\u002Fmodules\u002Fvital-holograms","docs\u002F4.modules\u002Fvital-holograms\u002F1.index",[141,142,146],{"title":82,"path":138,"stem":139,"icon":8},{"title":143,"path":144,"stem":145},"Global holograms","\u002Fdocs\u002Fmodules\u002Fvital-holograms\u002Fglobal-holograms","docs\u002F4.modules\u002Fvital-holograms\u002F2.global-holograms",{"title":147,"path":148,"stem":149},"Player holograms","\u002Fdocs\u002Fmodules\u002Fvital-holograms\u002Fplayer-holograms","docs\u002F4.modules\u002Fvital-holograms\u002F3.player-holograms",{"title":151,"path":152,"stem":153,"children":154,"icon":99},"vital-inventories","\u002Fdocs\u002Fmodules\u002Fvital-inventories","docs\u002F4.modules\u002Fvital-inventories\u002F1.index",[155,156,160],{"title":82,"path":152,"stem":153,"icon":8},{"title":157,"path":158,"stem":159},"Normal inventories","\u002Fdocs\u002Fmodules\u002Fvital-inventories\u002Fnormal-inventories","docs\u002F4.modules\u002Fvital-inventories\u002F2.normal-inventories",{"title":161,"path":162,"stem":163},"Paged inventories","\u002Fdocs\u002Fmodules\u002Fvital-inventories\u002Fpaged-inventories","docs\u002F4.modules\u002Fvital-inventories\u002F3.paged-inventories",{"title":165,"path":166,"stem":167,"children":168,"icon":99},"vital-items","\u002Fdocs\u002Fmodules\u002Fvital-items","docs\u002F4.modules\u002Fvital-items\u002F1.index",[169,170,174],{"title":82,"path":166,"stem":167,"icon":8},{"title":171,"path":172,"stem":173},"Items","\u002Fdocs\u002Fmodules\u002Fvital-items\u002Fitems","docs\u002F4.modules\u002Fvital-items\u002F2.items",{"title":175,"path":176,"stem":177},"Item builders","\u002Fdocs\u002Fmodules\u002Fvital-items\u002Fitem-builders","docs\u002F4.modules\u002Fvital-items\u002F3.item-builders",{"title":179,"path":180,"stem":181,"children":182,"icon":99},"vital-localization","\u002Fdocs\u002Fmodules\u002Fvital-localization","docs\u002F4.modules\u002Fvital-localization\u002F1.index",[183,184],{"title":82,"path":180,"stem":181,"icon":8},{"title":185,"path":186,"stem":187},"Localization","\u002Fdocs\u002Fmodules\u002Fvital-localization\u002Flocalization","docs\u002F4.modules\u002Fvital-localization\u002F2.localization",{"title":189,"path":190,"stem":191,"children":192,"icon":99},"vital-minigames","\u002Fdocs\u002Fmodules\u002Fvital-minigames","docs\u002F4.modules\u002Fvital-minigames\u002F1.index",[193,194,208],{"title":82,"path":190,"stem":191,"icon":8},{"title":195,"path":196,"stem":197,"children":198,"icon":99},"Global games","\u002Fdocs\u002Fmodules\u002Fvital-minigames\u002Fglobal-games","docs\u002F4.modules\u002Fvital-minigames\u002F2.global-games\u002F1.index",[199,200,204],{"title":47,"path":196,"stem":197,"icon":8},{"title":201,"path":202,"stem":203},"States","\u002Fdocs\u002Fmodules\u002Fvital-minigames\u002Fglobal-games\u002Fstates","docs\u002F4.modules\u002Fvital-minigames\u002F2.global-games\u002F2.states",{"title":205,"path":206,"stem":207},"Countdown states","\u002Fdocs\u002Fmodules\u002Fvital-minigames\u002Fglobal-games\u002Fcountdown-states","docs\u002F4.modules\u002Fvital-minigames\u002F2.global-games\u002F3.countdown-states",{"title":209,"path":210,"stem":211,"children":212,"icon":99},"Instanced games","\u002Fdocs\u002Fmodules\u002Fvital-minigames\u002Finstanced-games","docs\u002F4.modules\u002Fvital-minigames\u002F3.instanced-games\u002F1.index",[213,214,218,221],{"title":47,"path":210,"stem":211,"icon":8},{"title":215,"path":216,"stem":217},"Instances","\u002Fdocs\u002Fmodules\u002Fvital-minigames\u002Finstanced-games\u002Finstances","docs\u002F4.modules\u002Fvital-minigames\u002F3.instanced-games\u002F2.instances",{"title":201,"path":219,"stem":220},"\u002Fdocs\u002Fmodules\u002Fvital-minigames\u002Finstanced-games\u002Fstates","docs\u002F4.modules\u002Fvital-minigames\u002F3.instanced-games\u002F3.states",{"title":205,"path":222,"stem":223},"\u002Fdocs\u002Fmodules\u002Fvital-minigames\u002Finstanced-games\u002Fcountdown-states","docs\u002F4.modules\u002Fvital-minigames\u002F3.instanced-games\u002F4.countdown-states",{"title":225,"path":226,"stem":227,"children":228,"icon":99},"vital-players","\u002Fdocs\u002Fmodules\u002Fvital-players","docs\u002F4.modules\u002Fvital-players\u002F1.index",[229,230],{"title":82,"path":226,"stem":227,"icon":8},{"title":231,"path":232,"stem":233},"Players","\u002Fdocs\u002Fmodules\u002Fvital-players\u002Fplayers","docs\u002F4.modules\u002Fvital-players\u002F2.players",{"title":235,"path":236,"stem":237,"children":238,"icon":99},"vital-scoreboards","\u002Fdocs\u002Fmodules\u002Fvital-scoreboards","docs\u002F4.modules\u002Fvital-scoreboards\u002F1.index",[239,240,244],{"title":82,"path":236,"stem":237,"icon":8},{"title":241,"path":242,"stem":243},"Global scoreboards","\u002Fdocs\u002Fmodules\u002Fvital-scoreboards\u002Fglobal-scoreboards","docs\u002F4.modules\u002Fvital-scoreboards\u002Fglobal-scoreboards",{"title":245,"path":246,"stem":247},"Player scoreboards","\u002Fdocs\u002Fmodules\u002Fvital-scoreboards\u002Fplayer-scoreboards","docs\u002F4.modules\u002Fvital-scoreboards\u002Fplayer-scoreboards",{"title":249,"path":250,"stem":251,"children":252,"icon":99},"vital-statistics","\u002Fdocs\u002Fmodules\u002Fvital-statistics","docs\u002F4.modules\u002Fvital-statistics\u002F1.index",[253,254],{"title":82,"path":250,"stem":251,"icon":8},{"title":84,"path":255,"stem":256},"\u002Fdocs\u002Fmodules\u002Fvital-statistics\u002Fconfiguration","docs\u002F4.modules\u002Fvital-statistics\u002F2.configuration",{"title":258,"path":259,"stem":260,"children":261,"icon":99},"vital-tasks","\u002Fdocs\u002Fmodules\u002Fvital-tasks","docs\u002F4.modules\u002Fvital-tasks\u002F1.index",[262,263,267,271],{"title":82,"path":259,"stem":260,"icon":8},{"title":264,"path":265,"stem":266},"Repeatable tasks","\u002Fdocs\u002Fmodules\u002Fvital-tasks\u002Frepeatable-tasks","docs\u002F4.modules\u002Fvital-tasks\u002F2.repeatable-tasks",{"title":268,"path":269,"stem":270},"Countdown tasks","\u002Fdocs\u002Fmodules\u002Fvital-tasks\u002Fcountdown-tasks","docs\u002F4.modules\u002Fvital-tasks\u002F3.countdown-tasks",{"title":272,"path":273,"stem":274},"Scheduled tasks","\u002Fdocs\u002Fmodules\u002Fvital-tasks\u002Fscheduled-tasks","docs\u002F4.modules\u002Fvital-tasks\u002F4.scheduled-tasks",{"title":276,"path":277,"stem":278,"children":279,"icon":99},"vital-utils (Also for non Vital projects)","\u002Fdocs\u002Fmodules\u002Fvital-utils","docs\u002F4.modules\u002Fvital-utils\u002F1.index",[280],{"title":82,"path":277,"stem":278,"icon":8},"i-lucide-package",{"title":283,"path":284,"stem":285,"children":286,"icon":398},"Recipes","\u002Fdocs\u002Frecipes","docs\u002F5.recipes\u002F1.index",[287,289,301,305,317,330,341,344,368,371,384],{"title":288,"path":284,"stem":285,"icon":8},"What are recipes?",{"title":119,"path":290,"stem":291,"children":292,"page":34},"\u002Fdocs\u002Frecipes\u002Fcommands","docs\u002F5.recipes\u002Fcommands",[293,297],{"title":294,"path":295,"stem":296},"Command with arg exception handler","\u002Fdocs\u002Frecipes\u002Fcommands\u002Fcommands","docs\u002F5.recipes\u002Fcommands\u002Fcommands",{"title":298,"path":299,"stem":300},"Global command exception handler","\u002Fdocs\u002Frecipes\u002Fcommands\u002Fglobal-exception-handler","docs\u002F5.recipes\u002Fcommands\u002Fglobal-exception-handler",{"title":302,"path":303,"stem":304},"Config","\u002Fdocs\u002Frecipes\u002Fconfig","docs\u002F5.recipes\u002Fconfig",{"title":306,"path":307,"stem":308,"children":309,"page":34},"Holograms","\u002Fdocs\u002Frecipes\u002Fholograms","docs\u002F5.recipes\u002Fholograms",[310,314],{"title":311,"path":312,"stem":313},"Global hologram","\u002Fdocs\u002Frecipes\u002Fholograms\u002Fglobal-holograms","docs\u002F5.recipes\u002Fholograms\u002Fglobal-holograms",{"title":147,"path":315,"stem":316},"\u002Fdocs\u002Frecipes\u002Fholograms\u002Fplayer-holograms","docs\u002F5.recipes\u002Fholograms\u002Fplayer-holograms",{"title":318,"path":319,"stem":320,"children":321,"page":34},"Inventories","\u002Fdocs\u002Frecipes\u002Finventories","docs\u002F5.recipes\u002Finventories",[322,326],{"title":323,"path":324,"stem":325},"Normal inventory","\u002Fdocs\u002Frecipes\u002Finventories\u002Fnormal-inventory","docs\u002F5.recipes\u002Finventories\u002Fnormal-inventory",{"title":327,"path":328,"stem":329},"Paged inventory","\u002Fdocs\u002Frecipes\u002Finventories\u002Fpaged-inventory","docs\u002F5.recipes\u002Finventories\u002Fpaged-inventory",{"title":171,"path":331,"stem":332,"children":333,"page":34},"\u002Fdocs\u002Frecipes\u002Fitems","docs\u002F5.recipes\u002Fitems",[334,338],{"title":335,"path":336,"stem":337},"Interactable items","\u002Fdocs\u002Frecipes\u002Fitems\u002Finteractable-items","docs\u002F5.recipes\u002Fitems\u002Finteractable-items",{"title":175,"path":339,"stem":340},"\u002Fdocs\u002Frecipes\u002Fitems\u002Fitem-builders","docs\u002F5.recipes\u002Fitems\u002Fitem-builders",{"title":185,"path":342,"stem":343},"\u002Fdocs\u002Frecipes\u002Flocalization","docs\u002F5.recipes\u002Flocalization",{"title":345,"path":346,"stem":347,"children":348,"page":34},"Minigames","\u002Fdocs\u002Frecipes\u002Fminigames","docs\u002F5.recipes\u002Fminigames",[349,353,357,361,365],{"title":350,"path":351,"stem":352},"Global minigame countdown states","\u002Fdocs\u002Frecipes\u002Fminigames\u002Fglobal-countdown-states","docs\u002F5.recipes\u002Fminigames\u002Fglobal-countdown-states",{"title":354,"path":355,"stem":356},"Global minigame states","\u002Fdocs\u002Frecipes\u002Fminigames\u002Fglobal-states","docs\u002F5.recipes\u002Fminigames\u002Fglobal-states",{"title":358,"path":359,"stem":360},"Instance countdown states","\u002Fdocs\u002Frecipes\u002Fminigames\u002Finstance-countdown-states","docs\u002F5.recipes\u002Fminigames\u002Finstance-countdown-states",{"title":362,"path":363,"stem":364},"Instance states","\u002Fdocs\u002Frecipes\u002Fminigames\u002Finstance-states","docs\u002F5.recipes\u002Fminigames\u002Finstance-states",{"title":215,"path":366,"stem":367},"\u002Fdocs\u002Frecipes\u002Fminigames\u002Finstances","docs\u002F5.recipes\u002Fminigames\u002Finstances",{"title":231,"path":369,"stem":370},"\u002Fdocs\u002Frecipes\u002Fplayers","docs\u002F5.recipes\u002Fplayers",{"title":372,"path":373,"stem":374,"children":375,"page":34},"Scoreboards","\u002Fdocs\u002Frecipes\u002Fscoreboards","docs\u002F5.recipes\u002Fscoreboards",[376,380],{"title":377,"path":378,"stem":379},"Global scoreboard","\u002Fdocs\u002Frecipes\u002Fscoreboards\u002Fglobal-scoreboard","docs\u002F5.recipes\u002Fscoreboards\u002Fglobal-scoreboard",{"title":381,"path":382,"stem":383},"Player scoreboard","\u002Fdocs\u002Frecipes\u002Fscoreboards\u002Fplayer-scoreboard","docs\u002F5.recipes\u002Fscoreboards\u002Fplayer-scoreboard",{"title":385,"path":386,"stem":387,"children":388,"page":34},"Tasks","\u002Fdocs\u002Frecipes\u002Ftasks","docs\u002F5.recipes\u002Ftasks",[389,392,395],{"title":268,"path":390,"stem":391},"\u002Fdocs\u002Frecipes\u002Ftasks\u002Fcountdown-tasks","docs\u002F5.recipes\u002Ftasks\u002Fcountdown-tasks",{"title":264,"path":393,"stem":394},"\u002Fdocs\u002Frecipes\u002Ftasks\u002Frepeatable-tasks","docs\u002F5.recipes\u002Ftasks\u002Frepeatable-tasks",{"title":272,"path":396,"stem":397},"\u002Fdocs\u002Frecipes\u002Ftasks\u002Fscheduled-tasks","docs\u002F5.recipes\u002Ftasks\u002Fscheduled-tasks","i-lucide-cooking-pot",7,{"id":401,"title":123,"body":402,"description":1127,"extension":1128,"meta":1129,"navigation":1130,"path":124,"rawbody":1131,"seo":1132,"stem":125,"__hash__":1133},"docs\u002Fdocs\u002F4.modules\u002Fvital-commands\u002Fexception-handling.md",{"type":403,"value":404,"toc":1124},"minimark",[405,409,422,425,428,597,606,617,620,635,638,831,851,854,863,896,901,910,922,934,944,950,1050,1059,1072,1085,1092,1120],[406,407,123],"h1",{"id":408},"exception-handling",[410,411,412,413,416,417,421],"p",{},"The commands module also includes a full solution for exception handling during your command execution.",[414,415],"br",{},"\nWhen a command is executed, the respective arg handlers are called as explained in ",[418,419,420],"a",{"href":120},"commands",".",[410,423,424],{},"When an exception occurs during that arg handler execution, Vital will search for appropriate arg exception handlers that can handle the exception that occurred for this arg handler.",[410,426,427],{},"E.g., You have the following command.",[429,430,435],"pre",{"className":431,"code":432,"filename":433,"language":434,"meta":99,"style":99},"language-java shiki shiki-themes material-theme-lighter github-light github-dark","@VitalCommand.Info(name = \"mycommand\")\npublic class MyCommand extends VitalCommand.Spigot {\n  @ArgHandler(arg = @Arg(name = \"myarg0 myarg1\"))\n  public ReturnState onMyArg0MyArg1BlaBla(Player player) {\n    throw new Exception();\n  }\n}\n","MyCommand.java","java",[436,437,438,476,504,542,570,586,592],"code",{"__ignoreMap":99},[439,440,443,447,451,454,458,462,466,470,473],"span",{"class":441,"line":442},"line",1,[439,444,446],{"class":445},"sP7_E","@",[439,448,450],{"class":449},"sbsja","VitalCommand.Info",[439,452,453],{"class":445},"(",[439,455,457],{"class":456},"sZMiF","name",[439,459,461],{"class":460},"smGrS"," =",[439,463,465],{"class":464},"sjJ54"," \"",[439,467,469],{"class":468},"s_sjI","mycommand",[439,471,472],{"class":464},"\"",[439,474,475],{"class":445},")\n",[439,477,479,482,485,489,492,495,498,501],{"class":441,"line":478},2,[439,480,481],{"class":449},"public",[439,483,484],{"class":449}," class",[439,486,488],{"class":487},"sbgvK"," MyCommand",[439,490,491],{"class":449}," extends",[439,493,494],{"class":487}," VitalCommand",[439,496,421],{"class":497},"stp6e",[439,499,500],{"class":487},"Spigot",[439,502,503],{"class":445}," {\n",[439,505,507,510,513,515,518,520,523,526,528,530,532,534,537,539],{"class":441,"line":506},3,[439,508,509],{"class":445},"  @",[439,511,512],{"class":449},"ArgHandler",[439,514,453],{"class":445},[439,516,517],{"class":456},"arg",[439,519,461],{"class":460},[439,521,522],{"class":445}," @",[439,524,525],{"class":449},"Arg",[439,527,453],{"class":445},[439,529,457],{"class":456},[439,531,461],{"class":460},[439,533,465],{"class":464},[439,535,536],{"class":468},"myarg0 myarg1",[439,538,472],{"class":464},[439,540,541],{"class":445},"))\n",[439,543,545,548,552,556,558,561,565,568],{"class":441,"line":544},4,[439,546,547],{"class":449},"  public",[439,549,551],{"class":550},"s_bVq"," ReturnState",[439,553,555],{"class":554},"sGLFI"," onMyArg0MyArg1BlaBla",[439,557,453],{"class":445},[439,559,560],{"class":550},"Player",[439,562,564],{"class":563},"s99_P"," player",[439,566,567],{"class":445},")",[439,569,503],{"class":445},[439,571,573,577,580,583],{"class":441,"line":572},5,[439,574,576],{"class":575},"sVHd0","    throw",[439,578,579],{"class":575}," new",[439,581,582],{"class":554}," Exception",[439,584,585],{"class":445},"();\n",[439,587,589],{"class":441,"line":588},6,[439,590,591],{"class":445},"  }\n",[439,593,594],{"class":441,"line":399},[439,595,596],{"class":445},"}\n",[410,598,599,600,421,603,605],{},"For demonstrational purposes, the arg handler above throws an ",[436,601,602],{},"Exception",[414,604],{},"\nHow are we supposed to handle this exception?",[410,607,608,609,613,614,616],{},"We ",[610,611,612],"strong",{},"could"," just wrap the statement that might throw the exception in a try-catch-block, but what if we have these kinds of statements across many commands?",[414,615],{},"\nTLDR; it won't work, we'd have to manually handle all exceptions everywhere... garbage...",[410,618,619],{},"The solution? Arg exception handlers.",[410,621,622,623,625,626,629,630,632,633,421],{},"When this ",[436,624,602],{}," is now thrown while you execute ",[436,627,628],{},"\u002Fmycommand myarg0 myarg1",", Vital will automatically look for an arg exception handler in your command class that is configured to handle an ",[436,631,602],{}," for ",[436,634,536],{},[410,636,637],{},"An arg exception handler may look like this.",[429,639,641],{"className":431,"code":640,"filename":433,"language":434,"meta":99,"style":99},"@VitalCommand.Info(name = \"mycommand\")\npublic class MyCommand extends VitalCommand.Spigot {\n  @ArgHandler(arg = @Arg(name = \"myarg0 myarg1\"))\n  public ReturnState onMyArg0MyArg1BlaBla(Player player) {\n    throw new Exception();\n  }\n  \n  @ArgExceptionHandler(arg = \"myarg0 myarg1\", type = Exception.class)\n  public void onMyArg0MyArg1Exception(Player player, Exception e) {\n    \u002F\u002F ...\n  }\n}\n",[436,642,643,663,681,711,729,739,743,749,786,814,821,826],{"__ignoreMap":99},[439,644,645,647,649,651,653,655,657,659,661],{"class":441,"line":442},[439,646,446],{"class":445},[439,648,450],{"class":449},[439,650,453],{"class":445},[439,652,457],{"class":456},[439,654,461],{"class":460},[439,656,465],{"class":464},[439,658,469],{"class":468},[439,660,472],{"class":464},[439,662,475],{"class":445},[439,664,665,667,669,671,673,675,677,679],{"class":441,"line":478},[439,666,481],{"class":449},[439,668,484],{"class":449},[439,670,488],{"class":487},[439,672,491],{"class":449},[439,674,494],{"class":487},[439,676,421],{"class":497},[439,678,500],{"class":487},[439,680,503],{"class":445},[439,682,683,685,687,689,691,693,695,697,699,701,703,705,707,709],{"class":441,"line":506},[439,684,509],{"class":445},[439,686,512],{"class":449},[439,688,453],{"class":445},[439,690,517],{"class":456},[439,692,461],{"class":460},[439,694,522],{"class":445},[439,696,525],{"class":449},[439,698,453],{"class":445},[439,700,457],{"class":456},[439,702,461],{"class":460},[439,704,465],{"class":464},[439,706,536],{"class":468},[439,708,472],{"class":464},[439,710,541],{"class":445},[439,712,713,715,717,719,721,723,725,727],{"class":441,"line":544},[439,714,547],{"class":449},[439,716,551],{"class":550},[439,718,555],{"class":554},[439,720,453],{"class":445},[439,722,560],{"class":550},[439,724,564],{"class":563},[439,726,567],{"class":445},[439,728,503],{"class":445},[439,730,731,733,735,737],{"class":441,"line":572},[439,732,576],{"class":575},[439,734,579],{"class":575},[439,736,582],{"class":554},[439,738,585],{"class":445},[439,740,741],{"class":441,"line":588},[439,742,591],{"class":445},[439,744,745],{"class":441,"line":399},[439,746,748],{"class":747},"su5hD","  \n",[439,750,752,754,757,759,761,763,765,767,769,772,775,777,779,781,784],{"class":441,"line":751},8,[439,753,509],{"class":445},[439,755,756],{"class":449},"ArgExceptionHandler",[439,758,453],{"class":445},[439,760,517],{"class":456},[439,762,461],{"class":460},[439,764,465],{"class":464},[439,766,536],{"class":468},[439,768,472],{"class":464},[439,770,771],{"class":445},",",[439,773,774],{"class":456}," type",[439,776,461],{"class":460},[439,778,582],{"class":747},[439,780,421],{"class":445},[439,782,783],{"class":747},"class",[439,785,475],{"class":445},[439,787,789,791,794,797,799,801,803,805,807,810,812],{"class":441,"line":788},9,[439,790,547],{"class":449},[439,792,793],{"class":449}," void",[439,795,796],{"class":554}," onMyArg0MyArg1Exception",[439,798,453],{"class":445},[439,800,560],{"class":550},[439,802,564],{"class":563},[439,804,771],{"class":445},[439,806,582],{"class":550},[439,808,809],{"class":563}," e",[439,811,567],{"class":445},[439,813,503],{"class":445},[439,815,817],{"class":441,"line":816},10,[439,818,820],{"class":819},"sutJx","    \u002F\u002F ...\n",[439,822,824],{"class":441,"line":823},11,[439,825,591],{"class":445},[439,827,829],{"class":441,"line":828},12,[439,830,596],{"class":445},[832,833,834],"blockquote",{},[410,835,836,837,840,841,843,844,846,847,850],{},"Note that the exception handler shown above will currently handle ",[610,838,839],{},"ALL exception",", because it's type is set to the super class of all exception (",[436,842,602],{},").",[414,845],{},"\nIf you only want to handle specific exceptions, you can narrow down your exceptions by simply using a different type, like ",[436,848,849],{},"@ArgExceptionHandler(arg = \"myarg0 myarg1\", type = IllegalArgumentException.class)",", etc.",[852,853],"hr",{},[410,855,856,857,859,860,862],{},"Just like in arg handlers, arg exception handlers also use the same method parameter binding technique.",[414,858],{},"\nSo you can freely choose whatever parameters you want to use for your method.",[414,861],{},"\nThe following parameters are supported and can freely be added to your method in whatever order you like.",[864,865,866,876,882,887],"ul",{},[867,868,869,872,873,875],"li",{},[436,870,871],{},"CommandSender"," or ",[436,874,560],{}," - The command sender or player that executed the command.",[867,877,878,881],{},[436,879,880],{},"String"," - The actual argument that your player executed.",[867,883,884,886],{},[436,885,525],{}," - The Vital arg annotation that was found for the command that the player executed.",[867,888,889,891,892,895],{},[436,890,602],{}," - The actual exception that occurred, you can freely just use ",[610,893,894],{},"your"," exception type for this parameter.",[897,898,900],"h2",{"id":899},"global-exceptions","Global exceptions",[410,902,903,904,906,907,909],{},"But even with all of this exception handling, there are still some loopholes...",[414,905],{},"\nWhat happens if we want to display a default message for all kinds of exceptions across our entire commands of your plugin?",[414,908],{},"\nWe'd have to create arg exception handlers for each command, and that isn't really what we want to do...",[410,911,912,913,421,916,918,919,421],{},"On top of everything that Vital already does, Vital also gives you an option to create a so-called ",[610,914,915],{},"global command exception handler",[414,917],{},"\nAs the name implies, this exception handler will be called across ",[610,920,921],{},"all of your commands in your plugin",[410,923,924,925,927,928,930,931,933],{},"E.g., your command ",[436,926,469],{}," has an arg handler that now experiences an exception.",[414,929],{},"\nVital will try to find an arg exception handler for that exception.",[414,932],{},"\nIf it fails, Vital will try to find a global exception handler that can handle the exception that was thrown.",[410,935,936,937,940,941,421],{},"Also, global exception handlers are ",[610,938,939],{},"not bound to a specific argument",", they only handle a specific exception and are called for ",[610,942,943],{},"all of your arguments",[410,945,946,947,421],{},"Global command exceptions handlers are defined in their own class that must be annotated with ",[436,948,949],{},"@VitalCommand.Advice",[429,951,954],{"className":431,"code":952,"filename":953,"language":434,"meta":99,"style":99},"@VitalCommand.Advice(commandSenderClass = CommandSender.class)\npublic class MyGlobalCommandExceptionHandler {\n  @VitalCommand.GlobalExceptionHandler(type = Exception.class)\n  public void onException(CommandSender sender, Exception e) {\n    \u002F\u002F ...\n  }\n}\n","MyGlobalCommandExceptionHandler.java",[436,955,956,979,990,1012,1038,1042,1046],{"__ignoreMap":99},[439,957,958,960,963,965,968,970,973,975,977],{"class":441,"line":442},[439,959,446],{"class":445},[439,961,962],{"class":449},"VitalCommand.Advice",[439,964,453],{"class":445},[439,966,967],{"class":456},"commandSenderClass",[439,969,461],{"class":460},[439,971,972],{"class":747}," CommandSender",[439,974,421],{"class":445},[439,976,783],{"class":747},[439,978,475],{"class":445},[439,980,981,983,985,988],{"class":441,"line":478},[439,982,481],{"class":449},[439,984,484],{"class":449},[439,986,987],{"class":487}," MyGlobalCommandExceptionHandler",[439,989,503],{"class":445},[439,991,992,994,997,999,1002,1004,1006,1008,1010],{"class":441,"line":506},[439,993,509],{"class":445},[439,995,996],{"class":449},"VitalCommand.GlobalExceptionHandler",[439,998,453],{"class":445},[439,1000,1001],{"class":456},"type",[439,1003,461],{"class":460},[439,1005,582],{"class":747},[439,1007,421],{"class":445},[439,1009,783],{"class":747},[439,1011,475],{"class":445},[439,1013,1014,1016,1018,1021,1023,1025,1028,1030,1032,1034,1036],{"class":441,"line":544},[439,1015,547],{"class":449},[439,1017,793],{"class":449},[439,1019,1020],{"class":554}," onException",[439,1022,453],{"class":445},[439,1024,871],{"class":550},[439,1026,1027],{"class":563}," sender",[439,1029,771],{"class":445},[439,1031,582],{"class":550},[439,1033,809],{"class":563},[439,1035,567],{"class":445},[439,1037,503],{"class":445},[439,1039,1040],{"class":441,"line":572},[439,1041,820],{"class":819},[439,1043,1044],{"class":441,"line":588},[439,1045,591],{"class":445},[439,1047,1048],{"class":441,"line":399},[439,1049,596],{"class":445},[410,1051,1052,1053,1055,1056,421],{},"As shown above, this global command exception handler will now automatically receive all exceptions that are otherwise not handled by any underlying arg exception handlers for any command.",[414,1054],{},"\nThis global exception handler ",[610,1057,1058],{},"will only be called if no arg exception handler exists that can handle the exception that was thrown, OR if an exception was thrown while your arg exception handler was called",[832,1060,1061],{},[410,1062,836,1063,840,1065,843,1067,846,1069,850],{},[610,1064,839],{},[436,1066,602],{},[414,1068],{},[436,1070,1071],{},"@VitalCommand.GlobalExceptionHandler(type = IllegalArgumentException.class)",[410,1073,1074,1075,1077,1078,1081,1082,1084],{},"But still, this isn't the final handling point for exceptions.",[414,1076],{},"\nIf all of these handlers fail (for whatever reason), the ",[436,1079,1080],{},"onCommandException"," lifecycle of your command class will be the ultimate fallback for any kind of exception that was thrown during your arg exception handler and global exception handlers.",[414,1083],{},"\nNormally, this would never happen, but to make sure that you always have control over what happens in your command lifecycle, this is the absolute fallback.",[410,1086,1087,1088,859,1090,862],{},"Just like arg exception handlers, global exception handlers also use the same method parameter binding technique.",[414,1089],{},[414,1091],{},[864,1093,1094,1100,1104,1108,1114],{},[867,1095,1096,872,1098,875],{},[436,1097,871],{},[436,1099,560],{},[867,1101,1102,881],{},[436,1103,880],{},[867,1105,1106,886],{},[436,1107,525],{},[867,1109,1110,1113],{},[436,1111,1112],{},"String[]"," - The values (any player input for any varibale) for your command arg.",[867,1115,1116,891,1118,895],{},[436,1117,602],{},[610,1119,894],{},[1121,1122,1123],"style",{},"html pre.shiki code .sP7_E, html code.shiki .sP7_E{--shiki-light:#39ADB5;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sbsja, html code.shiki .sbsja{--shiki-light:#9C3EDA;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sZMiF, html code.shiki .sZMiF{--shiki-light:#E2931D;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .smGrS, html code.shiki .smGrS{--shiki-light:#39ADB5;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sjJ54, html code.shiki .sjJ54{--shiki-light:#39ADB5;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .s_sjI, html code.shiki .s_sjI{--shiki-light:#91B859;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sbgvK, html code.shiki .sbgvK{--shiki-light:#E2931D;--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .stp6e, html code.shiki .stp6e{--shiki-light:#39ADB5;--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .s_bVq, html code.shiki .s_bVq{--shiki-light:#9C3EDA;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sGLFI, html code.shiki .sGLFI{--shiki-light:#6182B8;--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .s99_P, html code.shiki .s99_P{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#E36209;--shiki-default-font-style:inherit;--shiki-dark:#FFAB70;--shiki-dark-font-style:inherit}html pre.shiki code .sVHd0, html code.shiki .sVHd0{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#D73A49;--shiki-default-font-style:inherit;--shiki-dark:#F97583;--shiki-dark-font-style:inherit}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .su5hD, html code.shiki .su5hD{--shiki-light:#90A4AE;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sutJx, html code.shiki .sutJx{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#6A737D;--shiki-default-font-style:inherit;--shiki-dark:#6A737D;--shiki-dark-font-style:inherit}",{"title":99,"searchDepth":478,"depth":478,"links":1125},[1126],{"id":899,"depth":478,"text":900},"This page explains how you can handle exceptions during your command executions.","md",{},{"title":123},"---\ntitle: Exception handling\ndescription: This page explains how you can handle exceptions during your command executions.\nnavigation:\n  title: Exception handling\n---\n\n# Exception handling\n\nThe commands module also includes a full solution for exception handling during your command execution.  \nWhen a command is executed, the respective arg handlers are called as explained in [commands](\u002Fdocs\u002Fmodules\u002Fvital-commands\u002Fcommands).  \n\nWhen an exception occurs during that arg handler execution, Vital will search for appropriate arg exception handlers that can handle the exception that occurred for this arg handler.  \n\nE.g., You have the following command.  \n\n```java [MyCommand.java]\n@VitalCommand.Info(name = \"mycommand\")\npublic class MyCommand extends VitalCommand.Spigot {\n  @ArgHandler(arg = @Arg(name = \"myarg0 myarg1\"))\n  public ReturnState onMyArg0MyArg1BlaBla(Player player) {\n    throw new Exception();\n  }\n}\n```\n\nFor demonstrational purposes, the arg handler above throws an `Exception`.  \nHow are we supposed to handle this exception?  \n\nWe **could** just wrap the statement that might throw the exception in a try-catch-block, but what if we have these kinds of statements across many commands?  \nTLDR; it won't work, we'd have to manually handle all exceptions everywhere... garbage...  \n\nThe solution? Arg exception handlers.  \n\nWhen this `Exception` is now thrown while you execute `\u002Fmycommand myarg0 myarg1`, Vital will automatically look for an arg exception handler in your command class that is configured to handle an `Exception` for `myarg0 myarg1`.  \n\nAn arg exception handler may look like this.  \n```java [MyCommand.java]\n@VitalCommand.Info(name = \"mycommand\")\npublic class MyCommand extends VitalCommand.Spigot {\n  @ArgHandler(arg = @Arg(name = \"myarg0 myarg1\"))\n  public ReturnState onMyArg0MyArg1BlaBla(Player player) {\n    throw new Exception();\n  }\n  \n  @ArgExceptionHandler(arg = \"myarg0 myarg1\", type = Exception.class)\n  public void onMyArg0MyArg1Exception(Player player, Exception e) {\n    \u002F\u002F ...\n  }\n}\n```\n\n> Note that the exception handler shown above will currently handle **ALL exception**, because it's type is set to the super class of all exception (`Exception`).  \n> If you only want to handle specific exceptions, you can narrow down your exceptions by simply using a different type, like `@ArgExceptionHandler(arg = \"myarg0 myarg1\", type = IllegalArgumentException.class)`, etc.\n\n---\n\nJust like in arg handlers, arg exception handlers also use the same method parameter binding technique.  \nSo you can freely choose whatever parameters you want to use for your method.  \nThe following parameters are supported and can freely be added to your method in whatever order you like.  \n\n- `CommandSender` or `Player` - The command sender or player that executed the command.\n- `String` - The actual argument that your player executed.\n- `Arg` - The Vital arg annotation that was found for the command that the player executed.\n- `Exception` - The actual exception that occurred, you can freely just use **your** exception type for this parameter.\n\n## Global exceptions\n\nBut even with all of this exception handling, there are still some loopholes...  \nWhat happens if we want to display a default message for all kinds of exceptions across our entire commands of your plugin?  \nWe'd have to create arg exception handlers for each command, and that isn't really what we want to do...  \n\nOn top of everything that Vital already does, Vital also gives you an option to create a so-called **global command exception handler**.  \nAs the name implies, this exception handler will be called across **all of your commands in your plugin**.  \n\nE.g., your command `mycommand` has an arg handler that now experiences an exception.  \nVital will try to find an arg exception handler for that exception.  \nIf it fails, Vital will try to find a global exception handler that can handle the exception that was thrown.  \n\nAlso, global exception handlers are **not bound to a specific argument**, they only handle a specific exception and are called for **all of your arguments**.  \n\nGlobal command exceptions handlers are defined in their own class that must be annotated with `@VitalCommand.Advice`.  \n\n```java [MyGlobalCommandExceptionHandler.java]\n@VitalCommand.Advice(commandSenderClass = CommandSender.class)\npublic class MyGlobalCommandExceptionHandler {\n  @VitalCommand.GlobalExceptionHandler(type = Exception.class)\n  public void onException(CommandSender sender, Exception e) {\n    \u002F\u002F ...\n  }\n}\n```\n\nAs shown above, this global command exception handler will now automatically receive all exceptions that are otherwise not handled by any underlying arg exception handlers for any command.  \nThis global exception handler **will only be called if no arg exception handler exists that can handle the exception that was thrown, OR if an exception was thrown while your arg exception handler was called**.  \n\n> Note that the exception handler shown above will currently handle **ALL exception**, because it's type is set to the super class of all exception (`Exception`).  \n> If you only want to handle specific exceptions, you can narrow down your exceptions by simply using a different type, like `@VitalCommand.GlobalExceptionHandler(type = IllegalArgumentException.class)`, etc. \n\nBut still, this isn't the final handling point for exceptions.  \nIf all of these handlers fail (for whatever reason), the `onCommandException` lifecycle of your command class will be the ultimate fallback for any kind of exception that was thrown during your arg exception handler and global exception handlers.  \nNormally, this would never happen, but to make sure that you always have control over what happens in your command lifecycle, this is the absolute fallback.\n\nJust like arg exception handlers, global exception handlers also use the same method parameter binding technique.  \nSo you can freely choose whatever parameters you want to use for your method.  \nThe following parameters are supported and can freely be added to your method in whatever order you like.  \n\n- `CommandSender` or `Player` - The command sender or player that executed the command.\n- `String` - The actual argument that your player executed.\n- `Arg` - The Vital arg annotation that was found for the command that the player executed.\n- `String[]` - The values (any player input for any varibale) for your command arg.\n- `Exception` - The actual exception that occurred, you can freely just use **your** exception type for this parameter.\n",{"title":123,"description":1127},"hYA5-6PGzGK9-MfZAgQm_0HzX9N9EODwcucVLozoS0k",1789308658758]