For pure PS then an if statement is pretty straightforward.
$appSvc = az webapp ...
if (!$appSvc) {
# Something went wrong
}
Unfortunately this doesn't work with az because it generates its own errors anyway. Even PS error handling doesn't work properly here. There is a blog article that discusses how you can work around this partially in PS. In my experience you'll still see the error from PS but you should be able to handle the error programmatically anyway.