Manual:Exception

Ways of throwing an exception or error include, e.g.:
 * ApiBase::dieWithError ( $msg, $code = null, $data = null, $httpCode = null )
 * ApiBase::dieWithException ( $exception, array $options = [] )