This isn't quite right. You'll end up throwing things like {throw, {unauthorized, <<"dbname">>}} since you're including the tag here. You want to use an after clause that'll fire regardless of the exception type and not interfere with the bubbling expression.