         TextFieldTableViewCell.registerCell(for: tableView)
     }
 
-    fileprivate enum TypeAlerts {
-        case errorMessage(String)
-        case errorUnknown
+    fileprivate func showErrorAlert(_ errorMessage: String?) {
+        let errorMessage = errorMessage ?? localized("error.socket.default_error_message")
 
-        func message() -> String {
-            switch self {
-            case .errorMessage(let message):
-                return message
-            case .errorUnknown:
-                return localized("error.socket.default_error_message")
-            }
-        }
-    }
-
-    fileprivate func showAlert(_ typeAlert: TypeAlerts) {
         let alert = UIAlertController(
             title: localized("error.socket.default_error_title"),
-            message: typeAlert.message(),
+            message: errorMessage,
             preferredStyle: .alert
         )
         alert.addAction(UIAlertAction(title: localized("global.ok"), style: .default, handler: nil))

        }

        sender.isEnabled = false
        API.shared.fetch(RoomCreateRequest(roomName: roomName, type: roomType, readOnly: readOnlyRoom)) { [weak self] result in

            guard let success = result?.raw?["success"].boolValue,
                success == true else {
                    if let errorMessage = result?.raw?["error"].string {
                        self?.showAlert(.errorMessage(errorMessage))
                    } else {
                        self?.showAlert(.errorUnknown)
                    }
                    sender.isEnabled = true
                    return
            }


                    let controller = ChatViewController.shared
                    controller?.subscription = newRoom

                    completion(true, nil)
                } else {
                    completion(false, nil)
                }
            }
        }
