It kind of depends on what you mean by "abnormal" and "error". In the case of LinearOptimization::nsolc
, that's a message id. If you want to deal with handle situations where messages were generated, the typical strategy would be to use Check
(http://reference.wolfram.com/language/ref/Check.html). For other "failure" cases, Confirm
with an enclosing Enclose
would be typical.
So, for example,
Check[LinearOptimization[x, {x <= 0, x >= 1}, x], "whatever you want in the failure case goes here"]
You could use ConfirmQuiet
to generate an actual Failure
expression.
Enclose[ConfirmQuiet[LinearOptimization[x, {x <= 0, x >= 1}, x]], functionToApplyToFailure]
I understand that the documentation wasn't clear to you, but without knowing what you tried or what about the documentation you aren't understanding, I'm not sure what else to explicitly demonstrate. There are many examples in the documentation--have you tried them, or can you say which ones are confusing for you?