summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDamian Rzeszot <damian.rzeszot@gmail.com>2017-10-09 11:56:50 +0200
committerDamian Rzeszot <damian.rzeszot@gmail.com>2017-10-09 08:04:01 +0200
commit62d4b1483b850da0a99c2aa6c2da8b013e308f50 (patch)
tree08a05ef2e1e560d68902b2c59a6afe06b92c6904
parent39665aaad785115a023b8195c50819eca73b758a (diff)
swift | fix style guidelines
-rw-r--r--ru-ru/swift-ru.html.markdown8
-rw-r--r--swift.html.markdown8
2 files changed, 8 insertions, 8 deletions
diff --git a/ru-ru/swift-ru.html.markdown b/ru-ru/swift-ru.html.markdown
index 7ff660e1..46a91660 100644
--- a/ru-ru/swift-ru.html.markdown
+++ b/ru-ru/swift-ru.html.markdown
@@ -376,14 +376,14 @@ print("Имя :\(name)") // Имя: Яков
// Протокол `Error` используется для перехвата выбрасываемых ошибок
enum MyError: Error {
- case BadValue(msg: String)
- case ReallyBadValue(msg: String)
+ case badValue(msg: String)
+ case reallyBadValue(msg: String)
}
// фунции помеченные словом `throws` должны вызываться с помощью `try`
func fakeFetch(value: Int) throws -> String {
guard 7 == value else {
- throw MyError.ReallyBadValue(msg: "Действительно плохое значение")
+ throw MyError.reallyBadValue(msg: "Действительно плохое значение")
}
return "тест"
@@ -401,7 +401,7 @@ func testTryStuff() {
do {
// обычно try оператор, позволяющий обработать ошибку в `catch` блоке
try fakeFetch(value: 1)
- } catch MyError.BadValue(let msg) {
+ } catch MyError.badValue(let msg) {
print("Ошибка: \(msg)")
} catch {
// все остальное
diff --git a/swift.html.markdown b/swift.html.markdown
index 60915d72..46388ca5 100644
--- a/swift.html.markdown
+++ b/swift.html.markdown
@@ -361,14 +361,14 @@ print("Name is \(name)") // Name is Them
// The `Error` protocol is used when throwing errors to catch
enum MyError: Error {
- case BadValue(msg: String)
- case ReallyBadValue(msg: String)
+ case badValue(msg: String)
+ case reallyBadValue(msg: String)
}
// functions marked with `throws` must be called using `try`
func fakeFetch(value: Int) throws -> String {
guard 7 == value else {
- throw MyError.ReallyBadValue(msg: "Some really bad value")
+ throw MyError.reallyBadValue(msg: "Some really bad value")
}
return "test"
@@ -385,7 +385,7 @@ func testTryStuff() {
do {
// normal try operation that provides error handling via `catch` block
try fakeFetch(value: 1)
- } catch MyError.BadValue(let msg) {
+ } catch MyError.badValue(let msg) {
print("Error message: \(msg)")
} catch {
// must be exhaustive