File tree Expand file tree Collapse file tree 8 files changed +24
-30
lines changed
android/library/src/main/java/io/package
kotlin/src/main/kotlin/io/appwrite Expand file tree Collapse file tree 8 files changed +24
-30
lines changed Original file line number Diff line number Diff line change @@ -176,10 +176,10 @@ class Client @JvmOverloads constructor(
176
176
*
177
177
* @return this
178
178
*/
179
- @Throws({{ spec . title | caseUcfirst }}Exception ::class)
179
+ @Throws(IllegalArgumentException ::class)
180
180
fun setEndpoint(endpoint: String): Client {
181
- if (!( endpoint.startsWith("http://") || endpoint.startsWith("https://") )) {
182
- throw {{ spec . title | caseUcfirst }}Exception( "Invalid endpoint URL: $endpoint")
181
+ require( endpoint.startsWith("http://") || endpoint.startsWith("https://")) {
182
+ "Invalid endpoint URL: $endpoint"
183
183
}
184
184
185
185
this.endpoint = endpoint
@@ -189,16 +189,16 @@ class Client @JvmOverloads constructor(
189
189
}
190
190
191
191
/**
192
- * Set realtime endpoint
193
- *
194
- * @param endpoint
195
- *
196
- * @return this
197
- */
198
- @Throws({{ spec . title | caseUcfirst }}Exception ::class)
192
+ * Set realtime endpoint
193
+ *
194
+ * @param endpoint
195
+ *
196
+ * @return this
197
+ */
198
+ @Throws(IllegalArgumentException ::class)
199
199
fun setEndpointRealtime(endpoint: String): Client {
200
- if (!( endpoint.startsWith("ws://") || endpoint.startsWith("wss://") )) {
201
- throw {{ spec . title | caseUcfirst }}Exception( "Invalid realtime endpoint URL: $endpoint")
200
+ require( endpoint.startsWith("ws://") || endpoint.startsWith("wss://")) {
201
+ "Invalid realtime endpoint URL: $endpoint"
202
202
}
203
203
204
204
this.endpointRealtime = endpoint
Original file line number Diff line number Diff line change @@ -137,9 +137,7 @@ open class Client {
137
137
///
138
138
open func setEndpoint(_ endPoint: String) throws -> Client {
139
139
if !endPoint.hasPrefix("http://") && !endPoint.hasPrefix("https://") {
140
- throw {{spec .title | caseUcfirst }}Error(
141
- message: "Invalid endpoint URL: \(endPoint)"
142
- )
140
+ fatalError("Invalid endpoint URL: \(endPoint)")
143
141
}
144
142
145
143
self.endPoint = endPoint
@@ -160,9 +158,7 @@ open class Client {
160
158
///
161
159
open func setEndpointRealtime(_ endPoint: String) throws -> Client {
162
160
if !endPoint.hasPrefix("ws://") && !endPoint.hasPrefix("wss://") {
163
- throw {{spec .title | caseUcfirst }}Error(
164
- message: "Invalid realtime endpoint URL: \(endPoint)"
165
- )
161
+ fatalError("Invalid realtime endpoint URL: \(endPoint)")
166
162
}
167
163
168
164
self.endPointRealtime = endPoint
Original file line number Diff line number Diff line change @@ -152,10 +152,10 @@ class Client @JvmOverloads constructor(
152
152
*
153
153
* @return this
154
154
*/
155
- @Throws({{ spec . title | caseUcfirst }}Exception ::class)
155
+ @Throws(IllegalArgumentException ::class)
156
156
fun setEndpoint(endPoint: String): Client {
157
- if (!( endPoint.startsWith("http://") || endPoint.startsWith("https://") )) {
158
- throw {{ spec . title | caseUcfirst }}Exception( "Invalid endpoint URL: $endPoint")
157
+ require( endPoint.startsWith("http://") || endPoint.startsWith("https://")) {
158
+ "Invalid endpoint URL: $endPoint"
159
159
}
160
160
161
161
this.endPoint = endPoint
Original file line number Diff line number Diff line change @@ -134,9 +134,7 @@ open class Client {
134
134
///
135
135
open func setEndpoint(_ endPoint: String) throws -> Client {
136
136
if !endPoint.hasPrefix("http://") && !endPoint.hasPrefix("https://") {
137
- throw {{spec .title | caseUcfirst }}Error(
138
- message: "Invalid endpoint URL: \(endPoint)"
139
- )
137
+ fatalError("Invalid endpoint URL: \(endPoint)")
140
138
}
141
139
142
140
self.endPoint = endPoint
Original file line number Diff line number Diff line change @@ -171,7 +171,7 @@ class ServiceTest {
171
171
172
172
try {
173
173
client.setEndpoint(" htp://cloud.appwrite.io/v1" )
174
- } catch (e: AppwriteException ) {
174
+ } catch (e: IllegalArgumentException ) {
175
175
writeToFile(e.message)
176
176
}
177
177
Original file line number Diff line number Diff line change @@ -149,8 +149,8 @@ class Tests: XCTestCase {
149
149
150
150
do {
151
151
try client. setEndpoint ( " htp://cloud.appwrite.io/v1 " )
152
- } catch let error as AppwriteError {
153
- print ( error. message )
152
+ } catch {
153
+ print ( error)
154
154
}
155
155
156
156
wait ( for: [ expectation] , timeout: 10.0 )
Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ class ServiceTest {
138
138
139
139
try {
140
140
client.setEndpoint(" htp://cloud.appwrite.io/v1" )
141
- } catch (e: AppwriteException ) {
141
+ } catch (e: IllegalArgumentException ) {
142
142
writeToFile(e.message)
143
143
}
144
144
Original file line number Diff line number Diff line change @@ -139,8 +139,8 @@ class Tests: XCTestCase {
139
139
140
140
do {
141
141
try client. setEndpoint ( " htp://cloud.appwrite.io/v1 " )
142
- } catch let error as AppwriteError {
143
- print ( error. message )
142
+ } catch {
143
+ print ( error)
144
144
}
145
145
146
146
try ! await general. empty ( )
You can’t perform that action at this time.
0 commit comments