Page Menu
Home
Musing Studio
Search
Configure Global Search
Log In
Files
F12143236
ErrorConstants.swift
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
ErrorConstants.swift
View Options
import
Foundation
//
MARK:
- Network Errors
enum
NetworkError
:
Error
{
case
noConnectionError
}
extension
NetworkError
:
LocalizedError
{
public
var
errorDescription
:
String
?
{
switch
self
{
case
.
noConnectionError
:
return
NSLocalizedString
(
"There is no internet connection at the moment. Please reconnect or try again later."
,
comment
:
""
)
}
}
}
//
MARK:
- Account Errors
enum
AccountError
:
Error
{
case
invalidPassword
case
usernameNotFound
case
serverNotFound
case
invalidServerURL
case
couldNotSaveTokenToKeychain
case
couldNotFetchTokenFromKeychain
case
couldNotDeleteTokenFromKeychain
}
extension
AccountError
:
LocalizedError
{
public
var
errorDescription
:
String
?
{
switch
self
{
case
.
serverNotFound
:
return
NSLocalizedString
(
"The server could not be found. Please check the information you've entered and try again."
,
comment
:
""
)
case
.
invalidPassword
:
return
NSLocalizedString
(
"Invalid password. Please check that you've entered your password correctly and try logging in again."
,
comment
:
""
)
case
.
usernameNotFound
:
return
NSLocalizedString
(
"Username not found. Did you use your email address by mistake?"
,
comment
:
""
)
case
.
invalidServerURL
:
return
NSLocalizedString
(
"Please enter a valid instance domain name. It should look like
\"
https://example.com
\"
or
\"
write.as
\"
."
,
// swiftlint:disable:this line_length
comment
:
""
)
case
.
couldNotSaveTokenToKeychain
:
return
NSLocalizedString
(
"There was a problem trying to save your access token to the device, please try logging in again."
,
comment
:
""
)
case
.
couldNotFetchTokenFromKeychain
:
return
NSLocalizedString
(
"There was a problem trying to fetch your access token from the device, please try logging in again."
,
comment
:
""
)
case
.
couldNotDeleteTokenFromKeychain
:
return
NSLocalizedString
(
"There was a problem trying to delete your access token from the device, please try logging out again."
,
comment
:
""
)
}
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Oct 10, 6:24 AM (1 d, 4 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3441171
Attached To
rWFSUI WriteFreely SwiftUI
Event Timeline
Log In to Comment