When building a Module function, I try to throw an error box when this function facing some cases. But I don't know how to output this error box with ground methods.
Using the function Message should help, using some permutation of:
command[args]:= If[Condition,Run Command, Message[args]]
l::len = "Argument `1` is to small"; l[n_] := If[n > 10, n+1, Message[l::len, n];]
If n>10, the function completes, if n<10; the function will print a red error message, and in this case not compile but adding n+1 after the semicolon will print an error and complete the function.
The :: defines symbol::tags----
It's written about here: https://reference.wolfram.com/language/workflow/SetUpErrorCheckingAndMessagesInAFunction.html
Message Documentation- https://reference.wolfram.com/language/ref/Message.html?q=Message
I highly recommend looking up the documentation, with natural language searches, the search "make error message wolfram" took me to the WL guide page. WL documentation and stack exchange have loads of already answered questions and guides similar to your needs!