@@ -9,7 +9,7 @@ use async_trait::async_trait;
9
9
use tracing:: { info_span, Instrument } ;
10
10
11
11
use ndc_sdk:: connector;
12
- use ndc_sdk:: connector:: { Connector , ConnectorSetup } ;
12
+ use ndc_sdk:: connector:: { Connector , ConnectorSetup , Result } ;
13
13
use ndc_sdk:: json_response:: JsonResponse ;
14
14
use ndc_sdk:: models;
15
15
@@ -45,33 +45,10 @@ impl Connector for BigQuery {
45
45
fn fetch_metrics (
46
46
_configuration : & Arc < ndc_bigquery_configuration:: Configuration > ,
47
47
_state : & Self :: State ,
48
- ) -> Result < ( ) , connector :: FetchMetricsError > {
48
+ ) -> Result < ( ) > {
49
49
Ok ( ( ) )
50
50
}
51
51
52
- /// Check the health of the connector.
53
- ///
54
- /// For example, this function should check that the connector
55
- /// is able to reach its data source over the network.
56
- async fn health_check (
57
- _configuration : & Self :: Configuration ,
58
- state : & Self :: State ,
59
- ) -> Result < ( ) , connector:: HealthError > {
60
- health:: health_check ( & state. bigquery_client )
61
- . await
62
- . map_err ( |err| {
63
- tracing:: error!(
64
- meta. signal_type = "log" ,
65
- event. domain = "ndc" ,
66
- event. name = "Health check error" ,
67
- name = "Health check error" ,
68
- body = %err,
69
- error = true ,
70
- ) ;
71
- err
72
- } )
73
- }
74
-
75
52
/// Get the connector's capabilities.
76
53
///
77
54
/// This function implements the [capabilities endpoint](https://hasura.github.io/ndc-spec/specification/capabilities.html)
@@ -86,7 +63,7 @@ impl Connector for BigQuery {
86
63
/// from the NDC specification.
87
64
async fn get_schema (
88
65
configuration : & Self :: Configuration ,
89
- ) -> Result < JsonResponse < models:: SchemaResponse > , connector :: SchemaError > {
66
+ ) -> Result < JsonResponse < models:: SchemaResponse > > {
90
67
schema:: get_schema ( configuration)
91
68
. await
92
69
. map_err ( |err| {
@@ -112,7 +89,7 @@ impl Connector for BigQuery {
112
89
configuration : & Self :: Configuration ,
113
90
state : & Self :: State ,
114
91
request : models:: QueryRequest ,
115
- ) -> Result < JsonResponse < models:: ExplainResponse > , connector :: ExplainError > {
92
+ ) -> Result < JsonResponse < models:: ExplainResponse > > {
116
93
todo ! ( "query explain is currently not implemented" )
117
94
// query::explain(configuration, state, request)
118
95
// .await
@@ -138,7 +115,7 @@ impl Connector for BigQuery {
138
115
configuration : & Self :: Configuration ,
139
116
state : & Self :: State ,
140
117
request : models:: MutationRequest ,
141
- ) -> Result < JsonResponse < models:: ExplainResponse > , connector :: ExplainError > {
118
+ ) -> Result < JsonResponse < models:: ExplainResponse > > {
142
119
todo ! ( "mutation explain is currently not implemented" )
143
120
// mutation::explain(configuration, state, request)
144
121
// .await
@@ -164,7 +141,7 @@ impl Connector for BigQuery {
164
141
configuration : & Self :: Configuration ,
165
142
state : & Self :: State ,
166
143
request : models:: MutationRequest ,
167
- ) -> Result < JsonResponse < models:: MutationResponse > , connector :: MutationError > {
144
+ ) -> Result < JsonResponse < models:: MutationResponse > > {
168
145
todo ! ( "mutation is currently not implemented" )
169
146
// mutation::mutation(configuration, state, request)
170
147
// .await
@@ -189,7 +166,7 @@ impl Connector for BigQuery {
189
166
configuration : & Self :: Configuration ,
190
167
state : & Self :: State ,
191
168
query_request : models:: QueryRequest ,
192
- ) -> Result < JsonResponse < models:: QueryResponse > , connector :: QueryError > {
169
+ ) -> Result < JsonResponse < models:: QueryResponse > > {
193
170
query:: query ( configuration, state, query_request)
194
171
. await
195
172
. map_err ( |err| {
@@ -225,7 +202,7 @@ impl<Env: Environment + Send + Sync> ConnectorSetup for BigQuerySetup<Env> {
225
202
async fn parse_configuration (
226
203
& self ,
227
204
configuration_dir : impl AsRef < Path > + Send ,
228
- ) -> Result < <Self :: Connector as Connector >:: Configuration , connector :: ParseError > {
205
+ ) -> Result < <Self :: Connector as Connector >:: Configuration > {
229
206
// Note that we don't log validation errors, because they are part of the normal business
230
207
// operation of configuration validation, i.e. they don't represent an error condition that
231
208
// signifies that anything has gone wrong with the ndc process or infrastructure.
@@ -243,7 +220,8 @@ impl<Env: Environment + Send + Sync> ConnectorSetup for BigQuerySetup<Env> {
243
220
line,
244
221
column,
245
222
message,
246
- } ) ,
223
+ } )
224
+ . into ( ) ,
247
225
configuration:: error:: ParseConfigurationError :: EmptyConnectionUri { file_path } => {
248
226
connector:: ParseError :: ValidateError ( connector:: InvalidNodes ( vec ! [
249
227
connector:: InvalidNode {
@@ -252,16 +230,17 @@ impl<Env: Environment + Send + Sync> ConnectorSetup for BigQuerySetup<Env> {
252
230
message: "database connection URI must be specified" . to_string( ) ,
253
231
} ,
254
232
] ) )
233
+ . into ( )
255
234
}
256
235
configuration:: error:: ParseConfigurationError :: IoError ( inner) => {
257
- connector:: ParseError :: IoError ( inner)
236
+ connector:: ParseError :: IoError ( inner) . into ( )
258
237
}
259
238
configuration:: error:: ParseConfigurationError :: IoErrorButStringified ( inner) => {
260
- connector :: ParseError :: Other ( inner. into ( ) )
239
+ inner. into ( )
261
240
}
262
241
configuration:: error:: ParseConfigurationError :: DidNotFindExpectedVersionTag ( _)
263
242
| configuration:: error:: ParseConfigurationError :: UnableToParseAnyVersions ( _) => {
264
- connector:: ParseError :: Other ( Box :: new ( error) )
243
+ connector:: ErrorResponse :: from_error ( error)
265
244
}
266
245
} ) ?;
267
246
@@ -296,7 +275,7 @@ impl<Env: Environment + Send + Sync> ConnectorSetup for BigQuerySetup<Env> {
296
275
& self ,
297
276
_configuration : & <Self :: Connector as Connector >:: Configuration ,
298
277
metrics : & mut prometheus:: Registry ,
299
- ) -> Result < <Self :: Connector as Connector >:: State , connector :: InitializationError > {
278
+ ) -> Result < <Self :: Connector as Connector >:: State > {
300
279
state:: create_state (
301
280
// &configuration.connection_uri,
302
281
// &configuration.pool_settings,
@@ -306,7 +285,7 @@ impl<Env: Environment + Send + Sync> ConnectorSetup for BigQuerySetup<Env> {
306
285
. instrument ( info_span ! ( "Initialise state" ) )
307
286
. await
308
287
. map ( Arc :: new)
309
- . map_err ( |err| connector:: InitializationError :: Other ( err. into ( ) ) )
288
+ . map_err ( |err| connector:: ErrorResponse :: from_error ( err) )
310
289
. map_err ( |err| {
311
290
tracing:: error!(
312
291
meta. signal_type = "log" ,
0 commit comments