如果名称已经存在或组不存在,我想使用错误消息创建表格。 当我单击Submit时,我收到来自服务器的错误消息。 现在,使用“关闭确认”功能关闭对话框。
namespace Twilio\Exceptions;
class RestException extends TwilioException {
protected $statusCode;
/**
* Construct the exception. Note: The message is NOT binary safe.
* @link http://php.net/manual/en/exception.construct.php
* @param string $message [optional] The Exception message to throw.
* @param int $code [optional] The Exception code.
* @param int $statusCode [optional] The HTTP Status code.
* @since 5.1.0
*/
public function __construct($message, $code, $statusCode) {
$this->statusCode = $statusCode;
parent::__construct($message, $code);
}
/**
* Get the HTTP Status Code of the RestException
* @return int HTTP Status Code
*/
public function getStatusCode() {
return $this->statusCode;
}
}
但是现在我必须单击“保存”按钮,是否等待错误消息 如果显示message,请显示它,然后打开对话框。 如果没有错误消息,请在“关闭确认”上执行该功能。
我认为我遇到的问题是异步等待,我等待服务器应答以检查错误,然后关闭或关闭对话框。
这是我的功能提交
<button mat-raised-button class="createUserBtn" color="primary" type="submit" [disabled]="form.invalid" (click)="onCloseConfirm()">Save</button>