주어진 message를 Exception의 message로 지정한다.
public setMessage ( string $message ) : void | ||
$message | string | 지정할 message |
return | void |
private function connectToUser($user, $userInfo) { $handler = app('xe.user'); // retrieve account and email $existingAccount = $handler->accounts()->where(['provider' => $this->provider, 'accountId' => $userInfo->id])->first(); if (data_get($userInfo, 'email', false)) { $existingEmail = $handler->emails()->findByAddress($userInfo->email); } else { $existingEmail = null; } $id = $user->getId(); if ($existingAccount !== null && $existingAccount->userId !== $id) { $e = new XpressengineException(); $e->setMessage('이미 다른 회원에 의해 등록된 계정입니다.'); throw $e; } if ($existingEmail !== null && $existingEmail->userId !== $id) { $e = new XpressengineException(); $e->setMessage('이미 다른 회원에 의해 등록된 이메일입니다.'); throw $e; } $userData = $this->resolveUserInfo($userInfo); XeDB::beginTransaction(); try { if ($existingAccount === null) { $accountData = $this->resolveAccountInfo($userInfo); $existingAccount = $handler->accounts()->create($user, $accountData); } if ($existingEmail === null) { $existingEmail = $handler->emails()->create($user, ['address' => $userData['email']]); } } catch (\Exception $e) { XeDB::rollback(); throw $e; } XeDB::commit(); }